目录

npm常见错误

三个方面

1. npm ERR! code ELIFECYCLE npm ERR! errno 1

复制代码
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.15 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.15 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

解决方案:

复制代码
 npm install

改成

复制代码
npm install --save-dev node-sass

2. npm run dev error [npm ERR! code ELIFECYCLE]

复制代码
Laravel Mix Version: 1.4.3 
Node Version: v8.9.1 
NPM Version: 5.5.1 
OS: macOS 10.12.6

Description: 
ze Chunks Chunk Names 
mix.js 8.27 kB 0 [emitted] mix 
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the @ development 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! /Users/sunny/.npm/_logs/2017-12-21T17_00_33_319Z-debug.log 
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
npm ERR! @ dev: npm run development 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the @ dev 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! /Users/sunny/.npm/_logs/2017-12-21T17_00_33_347Z-debug.log

node_modules安装问题,执行以下:

复制代码
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install

这一步清除npm缓存很重要

复制代码
npm cache clear --force

3. npm install时,报错 install: node install.js安装失败

复制代码
 error chromedriver@2.33.2 install: `node install.js`
 error Exit status 1
 error Failed at the chromedriver@2.33.2 install script.
 error This is probably not a problem with npm. There is likely additional logging output above.

初步判断是这个zip文件没下载下来,然后手动下载一个chromedriver_win32.zip丢到C:\Users\用户\AppData\Local\Temp\chromedriver\目录下,结果因为这是一个临时文件夹,每次初始化的时候都会重新下载这个文件,从而又无法初始化解决方案 :

1. 加参数

复制代码
npm install --ignore-scripts

2. 更换数据源

复制代码
npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
本文是转载文章,点击查看原文
如有侵权,请联系 xyy@jishuzhan.net 删除
相关推荐
勘察加熊人1 小时前
vue猜词游戏
前端·vue.js·游戏
且心1 小时前
【问题处理】webpack4升webpack5,报错Uncaught ReferrnceError: process is not defined
前端·webpack5·process·uncaught·referrnceerror
我是哈哈hh2 小时前
【Vue】 核心特性实战解析:computed、watch、条件渲染与列表渲染
前端·javascript·vue.js·前端框架·vue·语法基础
龙在天2 小时前
“手速太快,分页翻车?”,前端分页竞态问题,看这一篇就够了
前端
Riesenzahn2 小时前
你使用过css3的:root吗?说说你对它的理解
前端·javascript
Riesenzahn2 小时前
在js中undefined和undeclared有什么区别?
前端·javascript
打野赵怀真2 小时前
平时有经常用到nextTick吗?谈谈你对nextTick的理解。
前端·javascript
LaoZhangAI2 小时前
2025最全Browser Use MCP指南:AI控制浏览器的开源解决方案与API接入全攻略
前端
leopai2 小时前
面试官最喜欢问的:前端怎么自动检测代码更新?
前端·javascript·面试
学不动学不明白2 小时前
接口错误码监听方法
前端