Angular-cli: Problem with running ng-cli. SyntaxError: Unexpected token : in JSON at position 9...

Created on 20 Feb 2017  路  7Comments  路  Source: angular/angular-cli

Please 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 have such error log all the time:

C:\Users\user\AppData\Roaming\npmnode_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\npmnode_modules\@angular\cli\ember-cli\lib\models\project.js:532:20)
at module.exports (C:\Users\user\AppData\Roaming\npmnode_modules\@
angular\cli\ember-cli\lib\cli\index.js:40:25)
at module.exports (C:\Users\user\AppData\Roaming\npmnode_modules\@
angular\cli\lib\cli\index.js:39:10)
at C:\Users\user\AppData\Roaming\npmnode_modules\@angular\cli\bin\
ng:135:5
at C:\Users\user\AppData\Roaming\npmnode_modules\@angular\cli\node
_modules\resolve\lib\async.js:47:14
at process (C:\Users\user\AppData\Roaming\npmnode_modules\@angular
\clinode_modules\resolve\lib\async.js:174:43)
at ondir (C:\Users\user\AppData\Roaming\npmnode_modules\@angular\c
linode_modules\resolve\lib\async.js:189:17)
at load (C:\Users\user\AppData\Roaming\npmnode_modules\@angular\cl
inode_modules\resolve\lib\async.js:70:43)
at onex (C:\Users\user\AppData\Roaming\npmnode_modules\@angular\cl
inode_modules\resolve\lib\async.js:93:31)
at C:\Users\user\AppData\Roaming\npmnode_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:

  1. 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.

  1. Then I uninstalled the nodejs

  2. restarted pc

  3. installed nodejs again

  4. 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\clinode_modules\chokidarnode_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.

Most helpful comment

All 7 comments

I am having the same error with the same stack trace.....I find it hard to figure out what the error really is

Me too.

Giovanni it is most likely because you upgraded urban global clip and you are using an older version on the current project, I fixed mine by following the official upgrade guideline for the project angular cli

@Itsdenty I had to reinstall the node and upgrade angular-cli by following these instructions https://github.com/angular/angular-cli#updating-angular-cli and https://gist.github.com/tonymtz/d75101d9bdf764c890ef Thank you!

Reinstalling node fixed it for me. Ensure to update both global and project versions.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hareeshav picture hareeshav  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments