5
votes

Trying to run:

npm install @angular-devkit/build-angular

Getting below while installing

npm ERR! Unexpected end of JSON input while parsing near '...npmjs.org/prelude-ls/'

Please help

2

2 Answers

6
votes

Cleaning the corrupted local npm cache may fix this error.

npm cache clean --force

Just run your npm command again after executing the above command in your terminal.


There could be few other reasons for the invalid JSON, as described in the official documentation here.

The official npm website has well documented most of the common errors. But unfortunately they don’t appear on the top results when you google the error.

0
votes

I got the same proplem. Try with below command. It's worked for me.

**npm cache clean --force**

Or else you can try removing all the files that were listed below problem will solve.

> For Windows : go to C:\Users\username\AppData\Roaming\npm-cache 
> Delete all files and install angular again.