解决npm install时报错无法安装chromedriver的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决npm install时报错无法安装chromedriver的问题相关的知识,希望对你有一定的参考价值。

最近使用vue开发了一个前端项目,开发好后准备部署到服务器上。从git仓库拉下项目代码后,运行npm install安装项目所依赖的模块时却报错了,错误信息如下:

> [email protected] install /app/developer/git-repository/back_admin_front/node_modules/chromedriver
> node install.js

/app/developer/git-repository/back_admin_front/node_modules/chromedriver/chromedriver is not writable: EACCES: permission denied, mkdir ‘/app/developer/git-repository/back_admin_front/node_modules/chromedriver/chromedriver‘
Downloading https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip
Saving to /tmp/chromedriver/chromedriver_linux64.zip
Received 781K...
Received 1575K...
Received 2359K...
Received 3143K...
Received 3852K total.
Extracting zip contents
Copying to target path /app/developer/git-repository/back_admin_front/node_modules/chromedriver/lib/chromedriver
ChromeDriver installation failed { Error: EACCES: permission denied, mkdir ‘/app/developer/git-repository/back_admin_front/node_modules/chromedriver/lib/chromedriver‘
    at Object.fs.mkdirSync (fs.js:885:18)
    at /app/developer/git-repository/back_admin_front/node_modules/chromedriver/install.js:230:10
    at <anonymous>
  errno: -13,
  code: ‘EACCES‘,
  syscall: ‘mkdir‘,
  path: ‘/app/developer/git-repository/back_admin_front/node_modules/chromedriver/lib/chromedriver‘ }
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /root/.npm/_logs/2018-10-10T02_21_34_357Z-debug.log

解决办法,先安装以下模块:

npm install --ignore-scripts

以上是关于解决npm install时报错无法安装chromedriver的问题的主要内容,如果未能解决你的问题,请参考以下文章

npm install时报错 npm ERR!Windows_NT 6.1.7601

npm install时报错 npm ERR!Windows_NT 6.1.7601

npm install 时报错npm ERR! Windows_NT 6.1.7601

npm install 时报错 Unexpected end of input at 1:15930

npm 在安装 Vue脚手架命令(npm install -g @vue/cli)时报错安装报错--“Unexpected end of JSON input while parsing near&#

npm install 和npm start各种报错无法解决的问题