Cannot run Ionic commands

Hello, after developing on a project for some time I’ve lost my ability to run any commands in the command line that begin with “ionic.” All commands ranging from “ionic info” to “ionic --version” to “ionic serve” return with


SyntaxError: Unexpected token

I’ve tried reinstalling node, cordova, and ionic both locally and globally and restarting my computer but none of these have fixed the issue and I am unable to continue development.

Has anyone else run into this issue or found a solution?

Have you tried debugging ionic command in node-debug?

1 Like

Thank you gmarziou, that helped me find the issue.

It was line 12 of node_modules\ionic\lib\ionic\config.js = JSON.parse(fs.readFileSync(path.join(home, this.file)));

My C:\Users\USER\ .ionic\ionic.config had been corrupted and deleting it solved the issue

Great, it’s a pity that ionic command does not indicate the file name when there’s such error.