Problem with running ng-cli. SyntaxError: Unexpected token : in JSON at position 9...
See original GitHub issuePlease provide us with the following information:
Windows 7 OS
Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Versions.
Please run
ng --version
. If there’s nothing outputted, please run in a Terminal:node --version
and paste the result here: v6.9.5
Repro steps.
Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.
The log given by the failure.
Normally this include a stack trace and some more information.
Installed ng-cli and it worked. But then I uninstalled ng-cli: npm -g uninstall @angular/cli npm cache clean.
After that installed ng-cli one more time: npm -g install @angular/cli@latest.
But using ng <some_command> have such error log all the time:
C:\Users\user\AppData\Roaming\npm\node_modules@angular\cli\ember-cli\l ib\models\project.js:537 throw reason; ^
SyntaxError: Unexpected token : in JSON at position 9
at Object.parse (native)
at Function.Project.closestSync (C:\Users\user\AppData\Roaming\npm
node_modules@angular\cli\ember-cli\lib\models\project.js:505:16)
at Function.Project.projectOrnullProject (C:\Users\user\AppData\Roa
ming\npm\node_modules@angular\cli\ember-cli\lib\models\project.js:532:20)
at module.exports (C:\Users\user\AppData\Roaming\npm\node_modules@
angular\cli\ember-cli\lib\cli\index.js:40:25)
at module.exports (C:\Users\user\AppData\Roaming\npm\node_modules@
angular\cli\lib\cli\index.js:39:10)
at C:\Users\user\AppData\Roaming\npm\node_modules@angular\cli\bin
ng:135:5
at C:\Users\user\AppData\Roaming\npm\node_modules@angular\cli\node
_modules\resolve\lib\async.js:47:14
at process (C:\Users\user\AppData\Roaming\npm\node_modules@angular
\cli\node_modules\resolve\lib\async.js:174:43)
at ondir (C:\Users\user\AppData\Roaming\npm\node_modules@angular\c
li\node_modules\resolve\lib\async.js:189:17)
at load (C:\Users\user\AppData\Roaming\npm\node_modules@angular\cl
i\node_modules\resolve\lib\async.js:70:43)
at onex (C:\Users\user\AppData\Roaming\npm\node_modules@angular\cl
i\node_modules\resolve\lib\async.js:93:31)
at C:\Users\user\AppData\Roaming\npm\node_modules@angular\cli\node
_modules\resolve\lib\async.js:23:47
at FSReqWrap.oncomplete (fs.js:123:15)
For trying to solve that issue took next steps:
- Uninstalled ng-cli by: npm -g uninstall @angular/cli npm cache clean
2.deleted all the node_modules, package.json in C:\Users\Administrator\AppData\Roaming included folders npm and npm-cache.
-
Then I uninstalled the nodejs
-
restarted pc
-
installed nodejs again
-
installed ng-cli: npm -g install @angular/cli@latest
7 but then using ng new myNewApp have the error again
don’t know what there may be a problem.
Mention any other details that might be useful.
Have such log after ng-cli installing:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules@a ngular\cli\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 1.1.1: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”} )
Thanks! We’ll be in touch soon.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
https://github.com/angular/angular-cli#updating-angular-cli
Reinstalling node fixed it for me. Ensure to update both global and project versions.