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
Logo

前往低代码交流专区

更多推荐