I have installed the @angular/cli on my MacBook machine(Sierra). Node server version is v6.9.5 and the npm version is 3.10.10. I have ran the following command to install the @angular/cli.
sudo npm install -g @angular-cli
When I run the ng --version command or any command for ng. It shows me the following error
Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error: SyntaxError: Unexpected token u in JSON at position 22 InvalidConfigError: Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error: SyntaxError: Unexpected token u in JSON at position 22 at InvalidConfigError (/usr/local/lib/node_modules/@angular/cli/models/config/config.js:10:9) at Function.fromConfigPath (/usr/local/lib/node_modules/@angular/cli/models/config/config.js:77:19) at Function.fromProject (/usr/local/lib/node_modules/@angular/cli/models/config.js:96:46) at Object. (/usr/local/lib/node_modules/@angular/cli/commands/build.js:7:35) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17)
I also uninstalled and @angualr/cli and clear the cache then reinstalled @angualr/cli. I run the following command.
sudo npm uninstall -g @angular/cli
npm cache clean sudo
npm install -g @angular/cli
I googled it and someone saying The format of angular-cli.json has changed couple of times. Maybe you still have an old version. Can you post your JSON somewhere with a link so we can have a look what might be wrong with it? –
There is no file for this name on whole machine.
Seems like a dup of #6087 and #5669
According to the OP on 6087, deleting the .angular-cli.json fixed it for him.
Not able to find the angular-cli.json. Could it be possible for you to share the path of the file?
/usr/local/lib/node_modules/@angular/cli
Above is the path.
It should be in your home directory,
Open your terminal and find your HOME path with the following command:
printenv
look for the HOME= variable, for me the result is:
HOME=/Users/ricardo_varanda
So then you would do the following:
rm /Users/ricardo_varanda/.angular-cli.json
No there is no file for this name in the HOME path.
Thank you so much. Resolve the issue by deleting the file from the HOME. It was hidden.
BTW why we need to delete the file?
The file was generated by an old version of the cli, possibly even the old package angular-cli, which had a different format for .angular-cli.json
Nice work @RicardoVaranda, glad this is resolved fo ryou @mumarm45.... closing
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Nice work @RicardoVaranda, glad this is resolved fo ryou @mumarm45.... closing