Error:
At first, I thought it was a node or NPM version problem. After a long time, I finally solved it
Solution:
If you have executed NPM install
, delete the node first_ Modules folder, otherwise an error may be reported when running
Execute the following command
npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver
Then execute NPM install
to download normally
Analysis:
After analysis, it is found that in some versions, the response of the URL of the zip file of chromedriver is 302 jump, while the get method of the built-in HTTP object of node.js is used in install.js, which cannot handle 302 jump; In other cases, it’s because Google apis.com is blocked. Even if we use scientific Internet access, we still can’t get the files
Reference:
https://segmentfault.com/a/1190000008310875
https://www.npmjs.com/package/chromedriver