电子安装错误:在 electron@1.4.6 安装后脚本"节点安装.js"失败



我正在尝试安装电子最新版本并遇到此错误。我尝试安装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版本的问题。可能electron与新版本的node不兼容。

我已经安装了nvm并安装了一个低版本的node。在我的例子中是v6.3.0。在那之后,我可以安装电子没有错误。

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

最新更新