npm ERR! chromedriver@2.43.1 install: `node install.js`

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chromedriver@2.43.1 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chromedriver@2.43.1 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/zyb/.npm/_logs/2019-02-19T07_45_25_225Z-debug.log

该问题是vue-cli脚手架的一个bug,原因是chromedriver的部分文件被国内网络给墙掉了,无法下载完整的chromedirver包,解决办法:

sudo npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
sudo npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

Password:

> chromedriver@2.46.0 install /Users/zyb/Desktop/attend/node_modules/chromedriver
> node install.js

/Users/zyb/Desktop/attend/node_modules/chromedriver/2.46/chromedriver is not writable: EACCES: permission denied, mkdir '/Users/zyb/Desktop/attend/node_modules/chromedriver/2.46'
/Users/zyb/Desktop/attend/node_modules/chromedriver/2.46/chromedriver is not writable: EACCES: permission denied, mkdir '/Users/zyb/Desktop/attend/node_modules/chromedriver/2.46'
Current existing ChromeDriver binary is unavailable, proceding with download and extraction.
Downloading from file:  http://cdn.npm.taobao.org/dist/chromedriver/2.46/chromedriver_mac64.zip
Saving to file: /tmp/2.46/chromedriver/chromedriver_mac64.zip
Received 781K...
Received 1564K...
Received 2351K...
Received 3132K...
Received 3918K...
Received 4700K...
Received 5483K...
Received 6264K...
Received 6891K total.
Extracting zip contents
Copying to target path /Users/zyb/Desktop/attend/node_modules/chromedriver/lib/chromedriver
Fixing file permissions
Done. ChromeDriver binary available at /Users/zyb/Desktop/attend/node_modules/chromedriver/lib/chromedriver/chromedriver
npm WARN The package babel-preset-es2015 is included as both a dev and production dependency.

+ chromedriver@2.46.0
added 11 packages from 10 contributors and audited 13790 packages in 39.12s
found 9 vulnerabilities (2 low, 1 moderate, 5 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

我的项目中是以及装好了node-sass的,如果直接装chromedriver会报报node-sass没有安装的错误

sudo npm installl node-sass -S

推荐阅读更多精彩内容