Cannot run Ionic commands


#1

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

undefined:1

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?


#2

Have you tried debugging ionic command in node-debug?


#3

Thank you gmarziou, that helped me find the issue.

It was line 12 of node_modules\ionic\lib\ionic\config.js
this.data = 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


#4

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