Every time I try installing any package or even if I try doing npm install
I keep getting this error. I have no idea why I am getting the error. I am totally ne
For posterity, my issue was that we switched from using nexus to artifactory. You can find that out by using npm config get registry which in my case printed out the URL to our old nexus repository. Then use npm config set registry https://artifactory.your-company.com/artifactory/api/npm/npm/ and that resolved my issue.
Deleting the package-lock.json didn't work for me. The issue was an extra comma in my package.json file.
Try copying your json file into jsonlint.com. It will give you more information to show you if the issue you're having is truly a syntax error.
Checkout this article https://dev.to/redslug/7-solutions-to-ejsonparse-or-unexpected-token-npm-install-error-20nh if none of the answers here help. It helped me.
It's because of a package-lock.json
merge conflict.
Delete the file, delete node_modules
, and run npm install
to solve the problem:
rm package-lock.json
rm -rf node_modules
npm install
Try this command "npm cache verify" if removing package.lock does not work
For me it happened, because I have added an entry in the script section of package.json
file. Check your pachage.json
file if you already added any item to the script section and try to remove or fix it.
Also check if there is no any kamma at the end of object right before }
close bracket.