vue-cli npm安装phantomjs失败

有时候在使用vue-cli的时候会出现类似下面的错误:

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "D:\Programs\nodejs\node.exe" "D:\Programs\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "phantomjs-prebuilt"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! phantomjs-prebuilt@2.1.14 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs phantomjs-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.

主要的原因是因为有墙,访问太慢,导致npm链接超时,官方原话在这里Error: connect ETIMEDOUT

解决方法:

方法1.开代理,这个就不讲啦,网上一大堆

方法2.使用cnpm命令

 #卸载安装失败的phantomjs-prebuilt
 npm uninstall phantomjs-prebuilt --save-dev
 cnpm  install

方法3.使用以下命令进行安装:

npm install phantomjs-prebuilt@2.1.14 --ignore-scripts

这种方法来自Stackoverflow

转载于:https://www.cnblogs.com/hua093/p/7047220.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值