【发布时间】:2018-01-19 07:51:37
【问题描述】:
我正在尝试在 OS X Sierra 上使用 npm 全局安装电子模块。当我跑步时
sudo npm install electron -g
我明白了
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js
> electron@1.7.5 postinstall /usr/local/lib/node_modules/electron
> node install.js
/usr/local/lib/node_modules/electron/install.js:48
throw err
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/dist'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.7.5 postinstall 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/ianwise/.npm/_logs/2017-08-10T22_16_42_927Z-debug.log
问题似乎是当 npm 运行 mkdir 时权限被拒绝...但是我使用 sudo 运行它,为什么会出现问题?
在此致谢
【问题讨论】:
-
selinux 有碍事吗?
-
@BobVale 我对selinux不熟悉,不好意思,有什么办法可以查一下吗?
-
抱歉错过了 osx 部分,不认为它有。
-
我有奇怪的权限被拒绝错误,当我确保节点和非是最新的时,其他包就消失了。
-
@BobVale 我目前在最新版本的 Node (v8.3.0) 和 nm (v5.3.0) 上运行,但不幸的是仍然没有运气。
标签: node.js npm permissions electron mkdir