Package that uses electron fails to install: trying to add file to /etc/service/watcher


#1

Hiya. If I take a brand new Glitch project and add the following dependency in package.json:

"@stdlib/stdlib": "0.0.10"

npm fails:

> 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-2195-1502586551864'

It looks like the electron postinstall is trying to write to /etc which isn’t allowed by Glitch.

Any hints as to a workaround? Should I complain to the electron people? Is there a way to tell npm to skip this postinstall? Maybe ask Glitch to allow things to be written to /etc/service/watcher?


#2

npm install --ignore-scripts will fix this situation! (Hat tip: https://stackoverflow.com/a/23506053/500207).


#3

Doh, --ignore-scripts skips the postinstall but doesn’t actually install electron. If you really want to install electron, you’ll have to fix the underlying problem, which is because Glitch defines TMPDIR to /etc: export | grep etc returns a line, declare -x TMPDIR="/etc/service/watcher". Overwrite this, e.g., export TMPDIR=/tmp and run npm install :smile:!

Glitch admins, why is TMPDIR set inside /etc instead of /tmp?


#4

It’s an npm thing (https://github.com/npm/npm/issues/4531), they rely on you expressly setting it.