npm 错误收集

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/rth362147773/article/details/80204726

前言

我们使用node,webpack,npm,gulp,各种插件等老是会遇到一堆问题。现在我收集一份我遇到过的错误,来分享给大家。

环境

window 10
node 8.11.1稳定版
npm 5.6.0
python 2.7.14

1.code ELIFECYCLE 错误

错误内容:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.2.0 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

问题原因:

node_modules安装问题。

解决方法:

rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install


2.node-sass安装错误

错误内容:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

问题原因:

是远程下载问题。

解决方法:

1.改用yarn下载
yarn install node-sass

2.改用cnpm下载
npm install -g cnpm --registry=https://registry.npm.taobao.org 
cnpm install node-sass

3.淘宝镜象
// linux、mac 下
SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass

// window 下
set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ && npm install node-sass

持续更新。。。

猜你喜欢

转载自blog.csdn.net/rth362147773/article/details/80204726