Unsuccessful installation of Node Red on Ubuntu 16.04 LTS

I'm trying to install Node Red in a desktop with Ubuntu 16.04 LTS operating system.
Already successfully installed Node.js (v4.2.6) and npm (v3.5.2).
But when I try to install Node Red using the command sudo npm install -g --unsafe-perm node-red, the things start to not working.

Can someone help me?
The error is as follows:

jhluna@nodered:~$ sudo npm install -g --unsafe-perm node-red
loadDep:bcrypt → resolveW
loadDep:punycode → networ
loadDep:readable-stream →
npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See Status :: Nodemailer
npm WARN deprecated mailparser@0.6.2: Mailparser versions older than v2.3.0 are deprecated
npm WARN deprecated mimelib@0.3.1: This project is unmaintained
npm WARN deprecated mailcomposer@2.1.0: This project is unmaintained
npm WARN deprecated buildmail@2.0.0: This project is unmaintained
loadDep:uuid → resolveWit
/usr/local/bin/node-red -> /usr/local/lib/node_modules/node-red/red.js
/usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi

bcrypt@2.0.1 install /usr/local/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack TypeError: this is not a typed array.
node-pre-gyp ERR! stack at Function.from (native)
node-pre-gyp ERR! stack at Object. (/usr/local/lib/node_modules/node-red/node_modules/bcrypt/node_modules/tar/lib/parse.js:33:27)
node-pre-gyp ERR! stack at Module._compile (module.js:410:26)
node-pre-gyp ERR! stack at Object.Module._extensions..js (module.js:417:10)
node-pre-gyp ERR! stack at Module.load (module.js:344:32)
node-pre-gyp ERR! stack at Function.Module._load (module.js:301:12)
node-pre-gyp ERR! stack at Module.require (module.js:354:17)
node-pre-gyp ERR! stack at require (internal/module.js:12:17)
node-pre-gyp ERR! stack at Object. (/usr/local/lib/node_modules/node-red/node_modules/bcrypt/node_modules/tar/lib/list.js:10:16)
node-pre-gyp ERR! stack at Module._compile (module.js:410:26)
node-pre-gyp ERR! System Linux 4.15.0-43-generic
node-pre-gyp ERR! command "/usr/bin/nodejs" "/usr/local/lib/node_modules/node-red/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v4.2.6
node-pre-gyp ERR! node-pre-gyp -v v0.9.1
node-pre-gyp ERR! This is a bug in node-pre-gyp.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR! https://github.com/mapbox/node-pre-gyp/issues
npm WARN install:bcrypt@2.0.1 bcrypt@2.0.1 install: node-pre-gyp install --fallback-to-build
npm WARN install:bcrypt@2.0.1 Exit status 7
/usr/local/lib
└── node-red@0.19.5

Hi,

You need a more recent version of Node. We recommend Node 8.x.

1 Like

In fact the easiest way is to use the Pi install script in the installation docs. It works fine on Ubuntu.

2 Likes

Thank you both.
I have performed the following procedures to be able to update Node.js to version 8.x:

sudo apt install curl

curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -

sudo apt-get install -y nodejs

After that, the Node.js and npm was updated, respectively, to v8.15.0 and 6.4.1 and I could install the Node Red using Pi install script as @Colin sad. The script was:

bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

The sources were:

https://nodered.org/docs/hardware/raspberrypi

Too late now, but just for reference, the Pi script would have upgraded node.js for you (using the same technique you did).