npm相关报错及解决方法

npm i (安装依赖)报错记录

1.报错:

npm ERR! chromedriver@2.46.0 install: node install.js
npm ERR! Failed at the chromedriver@2.46.0 install 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\vzhoumei\AppData\Roaming\npm-cache_logs\2020-04-03T07_14_11_107Z-debug.log

1.解决:(该问题是vue-cli脚手架的一个bug,是chromedriver的部分文件被国内网络给墙掉了,无法下载完整的chromedirver包)
npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
2.报错:

npm ERR! phantomjs-prebuilt@2.1.16 install: node install.js
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install 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\vzhoumei\AppData\Roaming\npm-cache_logs\2020-04-09T07_03_54_531Z-debug.log

2.解决:
npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
3.报错:

Module build failed: Error: Cannot find module 'node-sass'

npm ERR! node-sass@4.13.1 postinstall: node scripts/build.js
npm ERR! Failed at the node-sass@4.13.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\vzhoumei\AppData\Roaming\npm-cache_logs\2020-04-09T10_34_13_146Z-debug.log

3.解决:
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass(设置 sass 下载镜像源)
npm i node-sass
4.报错:

unlink

4.解决:
以管理员身份打开vscode,重新安装依赖

npm run dev (运行程序)报错:

1.报错:

Error: getaddrinfo ENOTFOUND test.jr.jd.com

1.解决:
host 配置问题
2.报错:

npm ERR! workflow@1.0.0 dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! Failed at the workflow@1.0.0 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! C:\Users\vzhoumei\AppData\Roaming\npm-cache_logs\2020-04-09T07_08_01_308Z-debug.log

2.解决:
https://www.jianshu.com/p/ea95656ce8d7
3.报错:

npm ERR! fastobject@0.1.0 dev: vue-cli-service serve
npm ERR! Failed at the fastobject@0.1.0 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! C:\Users\vzhoumei\AppData\Roaming\npm-cache_logs\2020-04-21T02_48_49_679Z-debug.log

3.解决:
删除 node_modules 文件夹,管理员身份打开 vscode ,重新安装依赖,(多次重复执行之前的操作)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。