Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected end of JSON input while run npm install [closed]

While installing the eslint npm package like this

npm i eslint -g

I got the below error:

npm ERR! Unexpected end of JSON input while parsing near '..."coveralls":"2.11.4",'

How can I fix this?

like image 748
dadwic Avatar asked May 01 '19 19:05

dadwic


People also ask

How do I clear Nodejs cache?

Run: “npm cache clean –force” are both not working and you still can't clear the cache, you can force clear the cache by running: npm cache clean --force or npm cache clean -f . This will force delete the npm cache on your computer.

How do I update npm package manager?

Method 1: Using npm update command to update the node package manager. Method 2: Using npm@latest command to update the node package manager. Method 3: Using PPA repository (only for Linux). Method 4: Using cache cleaning & stable installing (only for Linux).

How to fix unexpected end of JSON input while parsing?

Unexpected end of JSON input while parsing near '...nd-index-1.0.2.tgz" vuejs-templates/webpack#990 Yes,Clear the npm cache, If PLAN A doesn't work , Delete the complete npm cache and npm files from the folder and re-install it completely.

Why am I getting NPM error when installing a new package?

When you try to install a new package from the npm, sometimes you will see this following error due to the cache folder of npm gets corrupted. npm ERR! Unexpected end of JSON input while parsing near '...ic":"^3.0.0"} ,"devDep' npm ERR!

Why is my NPM not showing activity?

Show activity on this post. This happens something due to cache or outdated version of Node Package Manager i just updated my NPM it works fine here is command to update Npm to latest version Show activity on this post. Try to execute the installing cmd in admin folder.

Is NPM now read-only?

It is now read-only. npm is crashing. npm is producing an incorrect install. npm is doing something I don't understand. What's going wrong?


1 Answers

Follow these below steps:

Method 1:

1. clean your cache

npm cache clean --force

2. Then install latest angular cli:

npm install -g @angular/cli@latest

3. Then install your package

npm install -g eslint

Method 2:

1. Uninstall nodejs

2. Clear cache by this command: npm cache clean --force

3. delete package-lock.json and node node_modules folder

4. Install nodejs latest version

5. Install latest angular cli npm install -g @angular/cli@latest.

6. Run npm install.

7. Install your desired package that you wants.

Hope it resolve your issue.If not then please let me know.Generally,In most of the cases method 1 works if method 1 not works go for 2nd method. Thanks

like image 115
Avinash Singh Avatar answered Sep 30 '22 20:09

Avinash Singh