我无法用npm更新电子

时间:2021-06-17 07:27:53

I cannot update electron-prebuilt. I executed sudo npm update electron-prebuilt -g many times.

我不能更新电子预建。我多次执行sudo npm update electron-prebuilt -g。

But, The Permission denied Error occur every time in spite of using sudo.

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

Why I can't update electron successfully?

为什么我不能成功更新电子?

iojs3.2.0, OS X 10.10.5

iojs3.2.0,OS X 10.10.5

The following is error log.

以下是错误日志。

/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 个解决方案

#1


3  

The issue is reported at https://github.com/mafintosh/electron-prebuilt/issues/48 and a workaround seems to be to first install without the -g flag which will get the file into user folder first, and then install again with -g.

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

EDIT: I guess somehow the permissions are messed up and I'm doing chmod. It seems that if I chmod not only for the user myself but also for group and others it works. Maybe others could also give it a try?

编辑:我想不知何故权限搞砸了,我正在做chmod。似乎如果我不仅为用户自己chmod,也为团队和其他人chmod工作。也许其他人也可以尝试一下?

#2


2  

I had the same problem in OS X. I fixed it deleting the ~/.electron folder

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

#1


3  

The issue is reported at https://github.com/mafintosh/electron-prebuilt/issues/48 and a workaround seems to be to first install without the -g flag which will get the file into user folder first, and then install again with -g.

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

EDIT: I guess somehow the permissions are messed up and I'm doing chmod. It seems that if I chmod not only for the user myself but also for group and others it works. Maybe others could also give it a try?

编辑:我想不知何故权限搞砸了,我正在做chmod。似乎如果我不仅为用户自己chmod,也为团队和其他人chmod工作。也许其他人也可以尝试一下?

#2


2  

I had the same problem in OS X. I fixed it deleting the ~/.electron folder

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