[英]npm ERR! Unexpected end of JSON input while parsing near '
So this error randomly popped up while I was working on my project:所以这个错误在我处理我的项目时随机弹出:
I've searched online and most of the answers ask to run npm cache clean --force
.我在网上搜索过,大多数答案都要求运行
npm cache clean --force
。 This did not work for me :(这对我不起作用:(
I've also tried to reinstall npm but still get the same error.我也尝试重新安装 npm,但仍然出现相同的错误。
Here is the error-log:这是错误日志:
I've been stuck on this for a while hoping someone can help me out :/我已经坚持了一段时间希望有人可以帮助我:/
You should try to reinstall entirely nodejs from your computer.您应该尝试从您的计算机上完全重新安装 nodejs。 This could solve the problem.
这可以解决问题。
sudo apt-get remove nodejs
sudo apt-get install nodejs
You can try "yarn" instead of npm.您可以尝试“纱线”而不是 npm。
Installation (If you are using Mac):安装(如果您使用的是 Mac):
brew install yarn
Or check here https://classic.yarnpkg.com/en/docs/install/或者在这里查看https://classic.yarnpkg.com/en/docs/install/
Then just run (Works like "npm install")然后运行(像“npm install”一样工作)
yarn
try npm cache clean --force
, fixed the issue for me.尝试
npm cache clean --force
,为我解决了这个问题。
ref: npm-err-unexpected-end-of-json-input-while-parsing-near-743参考: npm-err-unexpected-end-of-json-input-while-parsing-near-743
For my Vue.js project this problem was solved by first deleting the package-lock.json file and then running npm install
对于我的 Vue.js 项目,通过首先删除 package-lock.json 文件然后运行
npm install
解决了这个问题
Comment from @user2864740 helped point me in this direction, thank you!来自@user2864740 的评论帮助我指明了这个方向,谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.