当我在mac上安装电子时,我得到了许可被拒绝的消息

时间:2018-01-05 08:23:38

标签: node.js electron

  MacdeMacBook-Air-5:electron-api-demos Mac$ sudo npm install

> electron-chromedriver@1.6.0 install /usr/local/yanxi/electron-api-demos/node_modules/electron-chromedriver
> node ./download-chromedriver.js

/usr/local/yanxi/electron-api-demos/node_modules/electron-chromedriver/download-chromedriver.js:16
  if (error != null) throw error
                     ^

Error: EACCES: permission denied, mkdir '/usr/local/yanxi/electron-api-demos/node_modules/electron-chromedriver/electron-tmp-download-7487-1515139845145'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-chromedriver@1.6.0 install: `node ./download-chromedriver.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron-chromedriver@1.6.0 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/Mac/.npm/_logs/2018-01-05T08_10_45_423Z-debug.log

它表明我没有许可 我尝试了很多方法来解决这个问题,但是不行! 我用过cmd:  sudo chmod 777 .  sudo chown -R nodody:nobody ./*

注意:我是在mac平台上做的!

1 个答案:

答案 0 :(得分:0)

尝试像这样运行NPM安装:

npm install --unsafe-perm=true --allow-root

上面使用的NPM配置标志的说明可以在这里找到: https://docs.npmjs.com/misc/config