1. 程式人生 > >解決npm install時報錯無法安裝chromedriver的問題

解決npm install時報錯無法安裝chromedriver的問題

deb 運行 platform supported com ora -bash likely 報錯

最近使用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的問題