ZPY博客

jenkins执行npm install 或cnpm install时安装chromeDriver报错

jenkins编译打包vue项目时,用npm install会很慢,用cnpm install时老是报以下错误:

ChromeDriver binary exists. Validating…
Current existing ChromeDriver binary is unavailable, proceding with download and extraction.
Downloading from file: https://cdn.npm.taobao.org/dist/chromedriver/2.46/chromedriver_linux64.zip
Saving to file: /tmp/2.46/chromedriver/chromedriver_linux64.zip
ChromeDriver installation failed Error with http(s) request: Error: getaddrinfo EAI_AGAIN cdn.npm.taobao.org cdn.npm.taobao.org:443


[npminstall:runscript:error]

chromedriver@^2.27.2 scripts.install run "node install.js" error: Error: Run "sh -c node install.js" error, exit code 1
✖ Install fail! Error: post install error, please remove node_modules before retry!
Run "sh -c node install.js" error, exit code 1
Error: post install error, please remove node_modules before retry!
Run "sh -c node install.js" error, exit code 1
at ChildProcess.proc.on.code (/opt/node-v10.15.0-linux-x64/lib/node_modules/cnpm/node_modules/runscript/index.js:74:21)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
npminstall version: 3.21.1
npminstall args: /opt/node-v10.15.0-linux-x64/bin/node /opt/node-v10.15.0-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/var/lib/jenkins/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org
Build step 'Execute shell' marked build as failure
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE

网上找了很多方法都无法解决我的问题。 无论是npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

还是cnpm install chromedriver都不行。。

最后试了很多,用下面的命令终于解决问题。

cnpm install --ignore-scripts