Vue项目构建出错

1、问题
ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 172.217.160.112:443
2、解决方案
第一步,在命令行中

npm install cross-env --save-dev 

第二步,在进行npm install

npm install 

3、示例

ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 172.217.160.112:443
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chromedriver@2.34.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chromedriver@2.34.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!     /Users/mapbar_front/.npm/_logs/2018-01-02T08_02_54_159Z-debug.log
mapbar-frontdeMacBook-Pro:mypro mapbar_front$ npm install cross-env --save-dev 
npm notice created a lockfile as package-lock.json. You should commit this file.
+ cross-env@5.1.3
added 2 packages in 9.35s
mapbar-frontdeMacBook-Pro:mypro mapbar_front$ npm install

> chromedriver@2.34.0 install /Users/mapbar_front/Desktop/vue项目/MyPro/node_modules/chromedriver
> node install.js

Downloading https://chromedriver.storage.googleapis.com/2.34/chromedriver_mac64.zip
Saving to /var/folders/yg/h73y7s4x5b7fk45p0nywfw8r0000gn/T/chromedriver/chromedriver_mac64.zip
Received 782K...
Received 1568K...
Received 2352K...
Received 3136K...
Received 3920K...
Received 4704K...
Received 5166K total.
Extracting zip contents
Copying to target path /Users/mapbar_front/Desktop/vue项目/MyPro/node_modules/chromedriver/lib/chromedriver
Fixing file permissions
Done. ChromeDriver binary available at /Users/mapbar_front/Desktop/vue项目/MyPro/node_modules/chromedriver/lib/chromedriver/chromedriver
added 7 packages in 26.377s

4、最好的解决方案,使用.npmrc文件

仔细查看,你会发现chromedriver在使用npm下载的时候出错导致,我们只需要通过cdn的方式,重新指定下载路径就行。

新建文件,文件名是 .npmrc

chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver
phantomjs_cdnurl=http://npm.taobao.org/mirrors/phantomjs
operadriver_cdnurl=http://npm.taobao.org/mirrors/operadriver
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值