我不能用npm更新电子

时间:2015-08-31 12:19:27

标签: node.js npm electron

我无法更新电子预制。 我多次执行sudo npm update electron-prebuilt -g

但是,即使使用sudo,每次都会发生权限被拒绝错误。

为什么我无法成功更新电子?

iojs3.2.0,OS X 10.10.5

以下是错误日志。

/usr/local/lib/node_modules/electron-prebuilt/install.js:15
  throw err
  ^

Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/electron-prebuilt/electron-tmp-download-818-1441021602097/electron-v0.31.1-darwin-x64.zip' -> '/Users/user_name/.electron/electron-v0.31.1-darwin-x64.zip'
at Error (native)
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "electron-prebuilt" "-g"
npm ERR! node v3.2.0
npm ERR! npm  v2.14.1
npm ERR! code ELIFECYCLE

npm ERR! electron-prebuilt@0.31.1 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron-prebuilt@0.31.1 postinstall script 'node install.js'.
npm ERR! This is most likely a problem with the electron-prebuilt 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 their info via:
npm ERR!     npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/lib/node_modules/npm-debug.log

2 个答案:

答案 0 :(得分:4)

此问题在https://github.com/mafintosh/electron-prebuilt/issues/48报告,解决方法似乎是首先安装没有-g标志,这将首先将文件放入用户文件夹,然后再次安装-g

编辑:我想某种方式的权限搞砸了,我正在做chmod。看来,如果我chmod不仅对我自己而且对groupothers也适用。也许其他人也可以尝试一下?

答案 1 :(得分:2)

我在OS X中遇到了同样的问题。我修复了它删除~/.electron文件夹