question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 <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:

  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\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:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
athapliyalcommented, Mar 6, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Unexpected token < in JSON at position 0
Since it looks like the error seems to have something to do with pulling JSON data from the server, I tried starting from...
Read more >
SyntaxError: Unexpected token < in JSON at position 1 #884
When deploying the same project without any changes, but using the vscode push command it worked. image. I can deploy other projects using...
Read more >
How to Fix SyntaxError: Unexpected token < in JSON at ...
In this case the error is thrown when response.json() tries to run and fails to parse the data from the server as JSON....
Read more >
Troubleshoot 'Uncaught SyntaxError: Unexpected token u in ...
The 'Uncaught SyntaxError: Unexpected token u in JSON at position 0' error is caused when the client has been asked to execute JSON.parse() ......
Read more >
Unexpected token < in JSON at position 0 - Dave Ceddia
The token and the position may vary, but the root cause is the same: the text that your app is trying to parse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found