0

I am getting a JSON error when I run npm install inside my project to install dependencies.

npm ERR! Unexpected end of JSON input while parsing near '...EsfB30RyD1HUtFKPTfwVO' npm ERR! A complete log of this run can be found in: npm ERR! /home/yogesh/.npm/_logs/2019-09-19T16_54_23_816Z-debug.log 

I have tried clearing the cache but nothing happened.

npm cache clean --force 

Also to reinstall the nodejs and all the things, but nothing solved.

Here's my package.json

{ "name": "project", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "~8.2.7", "@angular/common": "~8.2.7", "@angular/compiler": "~8.2.7", "@angular/core": "~8.2.7", "@angular/forms": "~8.2.7", "@angular/platform-browser": "~8.2.7", "@angular/platform-browser-dynamic": "~8.2.7", "@angular/router": "~8.2.7", "rxjs": "~6.4.0", "tslib": "^1.10.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.803.5", "@angular/cli": "~8.3.5", "@angular/compiler-cli": "~8.2.7", "@angular/language-service": "~8.2.7", "@types/node": "~8.9.4", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "codelyzer": "^5.0.0", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.5.3" } } 

How can I resolve this?

16
  • can u post the package json file? Commented Sep 19, 2019 at 17:04
  • @siddharth-pa Added it Commented Sep 19, 2019 at 17:07
  • Could you also post the full output of npm install ? Commented Sep 19, 2019 at 17:10
  • @Evert Added it Commented Sep 19, 2019 at 17:12
  • @YogeshDeveloper is that everything? This is super strange. Do you have a package-lock.json file and could you try deleting it? Commented Sep 19, 2019 at 17:12

2 Answers 2

3

Just uninstall & reinstall you angular cli. After clearing the cache of npm

npm cache clean --force npm uninstall @angular/cli npm install @angular/cli 

This will solve your problem.

Sign up to request clarification or add additional context in comments.

Comments

0

If you are using Vuejs then you want to install the latest nodejs package.

There are commands you run in your terminal -

curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh -o install_nvm.sh

nano install_nvm.sh

bash install_nvm.sh

nvm ls-remote

nvm install latest-version

nvm use latest-version

node -v

This will solve your problem.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.