npm i 安装时报错问题解决

本次 涉及到报错信息

问题一:
	npm ERR! Unexpected end of JSON input while parsing near '...uQGX+dC\r\nUVgNSft8LN'  

问题二:
	npm ERR! [email protected] postinstall: `node scripts/build.js`
	npm ERR! Exit status 1
	npm ERR!
	npm ERR! Failed at the [email protected] postinstall script.

问题报错在这里插入图片描述

npm ERR! Unexpected end of JSON input while parsing near ‘…uQGX+dC\r\nUVgNSft8LN’
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lenovo\AppData\Roaming\npm-cache_logs\2022-07-15T01_39_44_665Z-debug.log

原因 :可能之前 npm i 时 中途停止等问题产生,需要清理下缓存

解决方案
直接执行 npm cache clean --force, 如果执行成功,再执行npm install即可。
在这里插入图片描述
如果 不可以 多执行几次上面的操作就可以了

问题:
然后又紧接着报了个错误
在这里插入图片描述

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Lenovo\AppData\Roaming\npm-cache_logs\2022-07-15T01_48_51_367Z-debug.log

原因分析:
这个错误的出现是因为sass安装时获取源的问题,修改sass安装的源。

解决办法:使用taobao的npm

npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
回车
npm i
即可
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/estrusKing/article/details/125798130