我试图安装电子最新版本并遇到此错误。我尝试安装sudo
并降级到电子1.4.5,但此错误仍然存在。节点版本I使用的是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.
答案 0 :(得分:2)
原来我使用的node
版本存在问题。可能电子与发布的较新版节点不兼容。
我安装了nvm并安装了较低版本的节点。就我而言v6.3.0
。之后,我能够毫无错误地安装电子。
答案 1 :(得分:-1)
在使用sudo时也有同样的问题。 当我切换到root时,安装工作正常。