javascriptangulartypescriptangular-cli-v6

Invalid JSON character: "" at 0:0. when running command "ng update @angular/cli --migrate-only --from=1.7.4"


I have cloned a project from github and am trying to run it locally, it seems that the .angular-cli.json file needs to be updated, I have ran through some of the tutorials here on how to do that and am faced with this error.

ng update @angular/cli --migrate-only --from=1.7.4 Updating karma configuration Updating configuration Removing old config file (.angular-cli.json) Writing config file (angular.json) Invalid JSON character: "" at 0:0.


Solution

  • It seems that you are trying to upgrade angular core version for your cloned project. Any way this error happens due to json files wrong encoding so you must ensure that all your json files like (angular-cli.json, tslint.json and tsconfig.json) are UTF-8 encoded not UTF With BOM. You can change encoding of these files using VSCode or notepad++ so running ng update @angular/cli --migrate-only --from=1.7.4 should wrong smoothly without any problems