npm install issues due to JSON parsing error
I pulled my Angular project from a Git repository and I’m attempting to install the required dependencies. Whenever I run npm install, an error occurs related to JSON parsing. It disrupts the entire installation process.
The error points out something like “Unexpected end of JSON input” and after looking at the npm debug log, this is the stack trace I got:
30601 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...19"},"dist":{"integri'
30601 verbose stack at JSON.parse (<anonymous>)
30601 verbose stack at parseJson (/usr/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
30601 verbose stack at /usr/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
30602 verbose cwd /home/mrcoder/Projects/Angular/Ava/PFA/pfa-front-cpl
30603 verbose Linux 5.4.0-33-generic
30604 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
30605 verbose node v12.17.0
30606 verbose npm v6.14.4
30607 error Unexpected end of JSON input while parsing near '...19"},"dist":{"integri'
Here’s how my package.json file looks:
{
"name": "vex",
"version": "9.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
},
"private": true,
"dependencies": {
"@angular/animations": "~9.0.7",
"@angular/cdk": "~9.1.3",
"@angular/common": "~9.0.7",
"@angular/compiler": "~9.0.7",
"@angular/core": "~9.0.7",
"@angular/flex-layout": "9.0.0-beta.29",
"@angular/forms": "~9.0.7",
"@angular/material": "~9.1.3",
"@angular/platform-browser": "~9.0.7",
"@angular/platform-browser-dynamic": "~9.0.7",
"@angular/router": "~9.0.7",
"rxjs": "~6.5.4"
},
"devDependencies": {
"@angular-builders/custom-webpack": "~9.0.0",
"@angular-devkit/build-angular": "~0.900.7",
"@angular/cli": "~9.0.7",
"@angular/compiler-cli": "~9.0.7",
"@types/node": "~13.9.3",
"typescript": "~3.7.5"
}
}
Can anyone help me understand what’s causing this problem and how I can resolve it? Any advice would be greatly appreciated.