Unexpected end of JSON input while parsing near 'xxxxxx'

在安装react依赖插件的时候,出现了这种错误信息

一开始一脸懵逼,看了看后面的log文件,应该是缓存出现了问题,打开日志文件查看一下

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'cache',
1 verbose cli   'clean' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose npm-session eaa7920470736d7a
5 verbose stack Error: As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
5 verbose stack
5 verbose stack If you're sure you want to delete the entire cache, rerun this command with --force.
5 verbose stack     at clean (C:\Program Files\nodejs\node_modules\npm\lib\cache.js:72:22)
5 verbose stack     at EventEmitter.cache (C:\Program Files\nodejs\node_modules\npm\lib\cache.js:47:16)
5 verbose stack     at Object.commandCache.(anonymous function) (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:159:13)
5 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:131:30)
5 verbose stack     at process._tickCallback (internal/process/next_tick.js:61:11)
6 verbose cwd G:\chenqk\app\React\RedusAntD\redus-antd
7 verbose Windows_NT 10.0.15063
8 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "cache" "clean"
9 verbose node v10.15.3
10 verbose npm  v6.4.1
11 error As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
11 error
11 error If you're sure you want to delete the entire cache, rerun this command with --force.
12 verbose exit [ 1, true ]

在这里提到,详细堆栈错误,从NPM@5开始,NPM缓存自修复损坏问题,并保证从缓存中提取的数据有效。如果要确保所有内容都一致,请改用“npm cache verify”。另一方面,如果正在调试安装程序的问题,可以使用“npm install--cache/tmp/empty cache”使用临时缓存,而不是忽略实际缓存。

错误提示信息中给出了如果你想清除缓存,可以使用npm cache clean --force.

初步估计应该是更换node版本时,会存在缓存的问题,导致版本之间的冲突,在安装依赖组件时导致的冲突。

执行之后再进行cache check就会发现什么都没有了。

再次执行插件安装,就会执行成功。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值