Closed a1626 closed 7 years ago
A user on the npm repo suggested this:
sudo npm install -g electron --unsafe-perm=true --allow-root
which worked for me.
In that case, atleast documentation should be updated to include unsafe-perm
flag to install electon globally.
Thanks!
This is a supplement information.
I tried to install Electron on Windows 10 and suffered from a similar problem at postinstall
. However, with the tips in this topic, I executed the following and installed Electron successfully. Thanks!
npm install -g electron --unsafe-perm=true --allow-root
sorry, I can't install electron package with mentioned option, I run under centos 7
(A thousand apologies for posting this as a commentâI canât make a new issue because the âSubmit new issueâ button is disabled for me, and this issue is the closest to my problem.)
Iâm trying to npm install
electron@1.7.5 on whatever container Glitch.com offers (uname -a
says Linux 156ba0fda9dd 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
), and it fails here:
$ npm install electron --unsafe-perm=true
> electron@1.7.5 postinstall /app/node_modules/electron
> node install.js
/app/node_modules/electron/install.js:48
throw err
^
Error: EACCES: permission denied, mkdir '/etc/service/watcher/electron-tmp-download-23212-1502587828401'
at Error (native)
For some reason, the postinstall is trying to write to /etc
but thatâs not allowed on this container. Same error with and without --unsafe-perm=true
.
Is there any other way (flags, envvar, any configuration) to to ask npm to skip this step of the postinstall? I do not have sudo
here and my options are limited.
@fasiha there's a new doc here that should help: https://github.com/electron/electron/blob/master/docs/tutorial/installation.md
@zeke thanks for pointing that outâI had seen many of these troubleshooting tips in the FAQ youâd linked above, and I was hoping something else could fix this problem, but alas, even with npm install electron --save-dev --save-exact
, the postinstall hits Error: EACCES: permission denied, mkdir '/etc/service/watcher/electron-tmp-download-30817-1502589259046'
. (And as I mentioned, --unsafe-perm=true
has this same error as well.) Any other tips?
Iâm really surprised with thisâis electron on Linux not installable without sudo? Or is /etc/service/watcher` usually user-writable?
npm install --ignore-scripts
for the win!!! (Via SO, please upvote đ). Seems to work.
@fasiha Urgh, --ignore-scripts
will be successful, but it won't actually install electron đ
Like, if you ignore the scripts it won't try and download Electron. The issue here is your OS's temp directory does not appear to be writable by your user. You should fix that before anything else đ
@MarshallOfSound Seems a bit odd that the temp directory is in /etc
. That does not follow FHS.
@kgryte It's whatever require('os').tmpdir()
outputs I beleive
@MarshallOfSound Yes, but that is not what is being used (at least from what I can gather). If we follow the logic
https://github.com/electron-userland/electron-prebuilt/blob/e5fe0fb379b94fe8b1ea2d9b8452d9413f7ca609/install.js#L26 https://github.com/electron-userland/electron-download/blob/0c964902f110df1587d925ae26c550f4b9786957/lib/index.js#L189 https://github.com/electron-userland/electron-download/blob/0c964902f110df1587d925ae26c550f4b9786957/lib/index.js#L54 https://github.com/sindresorhus/env-paths/blob/e61ddbde6c89222f1b7a1f8b941a2d8ff2d60527/index.js
The process looks to be trying to create a directory for caching downloads. On @fasiha's system, for whatever reason, that logic seems to be failing.
FWIW and as an aside, periodically when I install electron
on various build systems (e.g., Travis CI, Circle CI, and AppVeyor), I encounter EACCES
errors, as well. I have never investigated the reasons for the periodic failures. I usually just restart my build jobs and the problem usually disappears.
@kgryte Probably means he has XDG_CACHE_HOME
set to something weird
@MarshallOfSound @kgryte thank you for your help, thank to the XDG_CACHE_HOME hint, I found this!!!
$ export | grep etc
# ... snip ...
declare -x TMPDIR="/etc/service/watcher"
How strange! This might be because Glitch.com treats /tmp
as part of the backed up filesystem and doesnât want apps/modules to using $TMPDIR
for actual junk. I will notify them of this weirdness.
@fasiha can you explain what is this? npm install --ignore-scripts
@Janatbek âThe --ignore-scripts argument will cause npm to not execute any scripts defined in the package.json. See npm-scripts.â (via https://docs.npmjs.com/cli/install)
Observed in the wild, occurred when run as root.
A user on the npm repo suggested this:
sudo npm install -g electron --unsafe-perm=true --allow-root
which worked for me.
reblevins, this worked for me too. You saved my day. Thanks a lot!
Still an issue on 3.05, the same issue i had on 2.05.
$ sudo npm install electron -g
/usr/bin/electron -> /usr/lib/node_modules/electron/cli.js
> electron@3.0.5 postinstall /usr/lib/node_modules/electron
> node install.js
/usr/lib/node_modules/electron/install.js:49
throw err
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@3.0.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@3.0.5 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
$ uname -r
4.18.0-kali1-amd64
In linux/mac machines (not tried on windows) global installation of electron is failing at
postinstall
script. It is givingEACCES
error