本次 涉及到报错信息
问题一:
npm ERR! Unexpected end of JSON input while parsing near '...uQGX+dC\r\nUVgNSft8LN'
问题二:
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 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! node-sass@4.14.1 postinstall:node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.14.1 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
即可