SyntaxError: Unexpected end of JSON input while parsing




Asked on October 26, 2018
I am installing Angular using following steps.

1.
npm uninstall -g @angular/cli

2.
npm cache verify

3.
npm install -g @angular/cli@latest

4.
ng new my-app

But getting error.

2167 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...:"686926a69d0c9c26a9b'
2167 verbose stack     at JSON.parse (<anonymous>)
2167 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2167 verbose stack     at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
2167 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
2168 verbose cwd D:\angular\my-app
2169 verbose Windows_NT 6.1.7600
2170 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
2171 verbose node v10.3.0
2172 verbose npm  v6.1.0
2173 error Unexpected end of JSON input while parsing near '...:"686926a69d0c9c26a9b'
2174 verbose exit [ 1, true ]

How to fix it?



Replied on October 26, 2018
Uninstall Angular then use command

npm cache clean --force

Then install Angular and create project. I hope it will work.




Replied on October 26, 2018
Nice. It is working.

Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us