npm "failed to parse json"
I had the same problem but "npm cache clean" didnt resolve it for me. I had to go back to my package.json and realize i had comma where it shouldn't i suppose as shown below:
},
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.4",
"jquery": "^3.1.1",
"laravel-mix": "0.*",
"lodash": "^4.17.4",
"vue": "^2.1.10",
}
after the "vue..." so I deleted that and every went back to normal. So it is worth checking the package.json file first before running npm cache clean
Thanks to Jivings from this comment:
npm cache clean
solved the problem.
Mostly, this error is due to a syntax error in package.json file. In my case, the opening curly brace for dependencies object in package.json was missing:-
Code--------------------------------
{
"name": "psrxjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies":
"rxjs": "^5.4.3"
}
}
In Laravel project:
- Delete 'node_modules' folder;
- npm cache clean
- npm update