简体   繁体   English

npm 错误! 解析 ' 附近时 JSON 输入意外结束

[英]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.

相关问题 “npm ERR,在附近解析时 JSON 输入意外结束”。 在安装 express.js 时 - “npm ERR! Unexpected end of JSON input while parsing near”, while installing express.js npm ERR:JSON 输入意外结束,同时在 '...nt“.”^7.1,0“,”babel-p' 附近解析 - npm ERR! Unexpected end of JSON input while parsing near '…nt“:”^7.1.0“,”babel-p' npm 错误! 解析 '..."jscs":"~3.0.7","moch' 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '..."jscs":"~3.0.7","moch' npm 错误! 在 '...ob":"^7.0.0","istanbu' 附近解析时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '...ob":"^7.0.0","istanbu' npm 错误! 解析 '.../openpgpjs.org\\r\\n\\r\\' 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '.../openpgpjs.org\r\n\r\' npm 错误! 解析 '...registry.npmjs.org/@i' 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '...registry.npmjs.org/@i' npm 错误! 在“…w2BfLygJAO9ZBvYIqZTld”附近解析时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '…w2BfLygJAO9ZBvYIqZTld' Angular ng 新投掷错误:npm ERR! 解析附近时 JSON 输入意外结束 - Angular ng new throwing error: npm ERR! Unexpected end of JSON input while parsing near npm 错误。 在“...tore-4.0.0,tgz”,“文件”附近解析时输入意外结束 JSON - npm ERR! Unexpected end of JSON input while parsing near '...tore-4.0.0.tgz","file' npm 安装错误在解析附近时 JSON 输入意外结束 - npm install error Unexpected end of JSON input while parsing near
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM