Installation of Node-Red on Ubuntu 18.04 Server

I rented a VPS-Server recently and want to try Node-Red on the Server as well, after everything works well already on my Raspberry Pi. But it would also be great to access the data from everywhere.

Unfortunately I do not get Node-Red running on my server. For the installation I followed more or less the tutorial on
Unfortunately this is only avaliable in german.

Here is what I entered and received in the terminal:
sudo apt-get install npm //no problems

node -v

npm -v

sudo npm install -g --unsafe-perm node-red

npm WARN ws@7.4.1 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.4.1 requires a peer of utf-8-validate@^5.0.2 but none was installed.

sudo npm install -g pm2

npm WARN optional Skipping failed optional dependency /pm2/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@2.1.3
npm WARN ws@7.2.5 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.2.5 requires a peer of utf-8-validate@^5.0.2 but none was installed.

sudo which node-red

sudo pm2 start /usr/local/bin/node-red
[PM2] Spawning PM2 daemon with pm2_home=/home/ssh_user/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /usr/local/bin/node-red in fork_mode (1 instance)
[PM2] Done.
โ”‚ id โ”‚ name โ”‚ mode โ”‚ โ†บ โ”‚ status โ”‚ cpu โ”‚ memory โ”‚
โ”‚ 0 โ”‚ node-red โ”‚ fork โ”‚ 0 โ”‚ online โ”‚ 0% โ”‚ 16.5mb โ”‚

sudo pm2 status
--> same result

sudo pm2 startup

sudo pm2 save

sudo -i

cd /etc/init.d/
ls -a

--> no avaliable to change USER=root to USER=hans

Has anyone an idea, what the problem could be? Initially I had node-red already running with Plesk as Admin-Panel installed, but now I changed to KeyHelp and it does not work any more. But I'm not sure, if this is the reason or something else.

Yesterday I already tried another solution:
npm install -g npm-install-peers
There doesn't seem to be a package.json here

If I try to reinstall node-red, then the peers seem still not to be installed. I would really appreciate, if someone has some idea, how to install node-red on my server.


This is a very old (2016) link!

The installation script in the documentation works well on Ubuntu, I have done it recently.

bash <(curl -sL

Yes - sometimes I wonder if there is a reason we write docs... :cry:

1 Like

If you have a look into that link, then you will see that the guy tried it again in 2019 and it worked. i also used this on my raspberry Pi and it worked out well. As I have written above, now I want to install it on a online-Webserver, although there should not be so much difference.

The documentation does not really show me any more information, that what I found in the tutorial. I was also on the docu before, but basically it just says

sudo npm install -g --unsafe-perm node-red

This it what gave me the errors/warnings.

I also just tried the script, which looked very promising at first, but there were still errors and I cannot access to the node-red via the http://ip:1880 after startup node-red, even as it says, the server is running

Also there were some errors during the install from the log:

## To install the Yarn package manager, run:
     curl -sL | sudo apt-key add -
     echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.5 MB of archives.
After this operation, 94.4 MB of additional disk space will be used.
Get:1 bionic/main amd64 nodejs amd64 12.20.0-1nodesource1 [18.5 MB]
Fetched 18.5 MB in 0s (56.9 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading dat$
Preparing to unpack .../nodejs_12.20.0-1nodesource1_amd64.deb ...
Unpacking nodejs (12.20.0-1nodesource1) ...
Setting up nodejs (12.20.0-1nodesource1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Versions: node:v12.20.0 npm:6.14.8
npm WARN using --force I sure hope you know what you are doing.
Now install Node-RED
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated request@2.88.0: request has been deprecated, see
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bcrypt@3.0.8: versions < v5.0.0 do not handle NUL in passwords properly
/usr/bin/node-red -> /usr/lib/node_modules/node-red/red.js
/usr/bin/node-red-pi -> /usr/lib/node_modules/node-red/bin/node-red-pi

> bcrypt@3.0.6 install /usr/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404):$
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.6 and node@12.20.0 (node-v72 ABI, glibc) (falling back$
make: Entering directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
  CXX(target) Release/
make: g++: Command not found recipe for target 'Release/' failed
make: *** [Release/] Error 127
make: Leaving directory '/usr/lib/node_modules/node-red/node_modules/bcrypt/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.15.0
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallba$
gyp ERR! cwd /usr/lib/node_modules/node-red/node_modules/bcrypt
gyp ERR! node -v v12.20.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/$
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/node-red/node_modules/node-pre-gyp/li$
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 4.15.0
node-pre-gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-red/node_modules/.bin/node-pre-gyp" "install" $
node-pre-gyp ERR! cwd /usr/lib/node_modules/node-red/node_modules/bcrypt
node-pre-gyp ERR! node -v v12.20.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to$

> bcrypt@3.0.8 install /usr/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
[bcrypt] Success: "/usr/lib/node_modules/node-red/node_modules/node-red-admin/node_modules/bcrypt/lib/binding/bcrypt$
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 (node_modules/node-red/node_modules/bcrypt):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bcrypt@3.0.6 install: `node-pre-gyp install --fallback-to-build`

+ node-red@1.2.6
added 354 packages from 321 contributors in 24.118s
Now create basic package.json for the user and move any global nodes
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for ssh_user
Now add launcher to top bar, add cpu temp example, make sure ping works
Memory : 2.0G
Finished : Tue Dec 8 10:45:31 UTC 2020

That looks a lot better - at least you are now on a supported version of nodejs :slight_smile:
The errors are then followed by a warning saying the optional dependency failed - which is fine as it is optional... and then it completes ok... so you should be able to run node-red-start

Thank you. That gave me some confidence to look after other reasons. I had not opened my 1880 port on the server. Actually I did it yesterday but afterwards I restored a backup from before and so the port was closed again. No I can access Node-Red. Thanks for your help.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.