NodeJS on Raspberry PI and Electron failure to chooch

Working on a Raspberry PI today and wanted to run Node on it. Easy.

sudo apt install nodejs

boom, done right? Wrong. Tried to install an npm package and this

pi@raspberrypi:~ $ sudo npm install -g electron --unsafe-perm=true --allow-root
(node:4043) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)

What to do instead? Run these commands, do go to and get the link to the latest version though from the node website.

cd /tmp
tar xvf node-v10.15.1-linux-armv7l.tar.xz 
cd node-v10.15.1-linux-armv7l/
sudo cp -R * /usr/local/

When that’s all good done, install your package again. This is because apt installs Node v8, which is no es bueno with electron.

sudo npm install -g electron --unsafe-perm=true --allow-root

And that should work just fine

/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js

> electron@4.0.4 postinstall /usr/local/lib/node_modules/electron
> node install.js

Downloading tmp-4311-1-SHASUMS256.txt-4.0.4
[============================================>] 100.0% of 4.74 kB (4.74 kB/s)
+ electron@4.0.4
added 145 packages from 139 contributors in 111.458s

The latest electron doesn’t actually work, but look it’s installed.

~/electron-quick-start $ npm start

> electron-quick-start@1.0.0 start /home/pi/electron-quick-start
> electron .

/usr/local/lib/node_modules/electron/dist/electron: /lib/arm-linux-gnueabihf/ version `GLIBC_2.27' not found (required by /usr/local/lib/node_modules/electron/dist/electron)
npm ERR! errno 1
npm ERR! electron-quick-start@1.0.0 start: `electron .`
npm ERR! Exit status 1