Unexpected end of JSON input while run npm install

Trying to run:

npm i eslint -g

Getting below while installing

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



Flow these below steps:

Method 1:

1. clean your cache (C:\Users\username\AppData\Roaming\npm-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