electron install error : Failed at the electron@1.4.6 postinstall script 'node install.js'

electron install error : Failed at the electron@1.4.6 postinstall script 'node install.js'

我正在尝试安装 electron 最新版本并遇到此错误。我尝试安装 sudo 并降级到电子 1.4.5,但此错误仍然存​​在。我使用的节点版本是 v7.1.0

完整的错误日志

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.6.0/bin/node" "/usr/local/bin/npm" "install" "-g" "electron@1.4.5" "--verbose"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.7
npm ERR! code ELIFECYCLE

npm ERR! electron@1.4.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.4.5 postinstall script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs electron
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls electron
npm ERR! There is likely additional logging output above.

原来是我用的node版本有问题。可能电子与发布的较新版本的节点不兼容。

我已经安装了nvm并且安装了低版本的node。就我而言 v6.3.0。之后我就可以毫无错误地安装电子了。

有同样的问题,也是在使用 sudo 时。 当我切换到 root 时,安装成功了。