# Installation of Node-Red on Ubuntu 18.04 Server

**URL:** <https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173>\
**Category:** General\
**Created:** [8 December 2020 09:51 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173 "2020-12-08T09:51:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefan2210](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@stefan2210](https://discourse.nodered.org/u/stefan2210)\
**Post date:** [8 December 2020 09:51 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/1 "2020-12-08T09:51:22Z")

</div>

Hey,  
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 [https://www.markjunghanns.de/index.php/2016/10/19/node-red-installation-ubuntu/](https://www.markjunghanns.de/index.php/2016/10/19/node-red-installation-ubuntu/)  
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  
v8.10.0

npm -v  
3.5.2

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

Warnings:  
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

Warnings:  
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  
/usr/local/bin/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 pm2-init.sh 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  
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.

Stefan

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [8 December 2020 10:10 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/2 "2020-12-08T10:10:14Z")

</div>

> [@stefan2210](#):
>
> [Node-RED - Installation unter Ubuntu - Mark's Haus-, Hof- und IT-Blog](https://www.markjunghanns.de/index.php/2016/10/19/node-red-installation-ubuntu/)

This is a very old (2016) link!

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

```auto
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 December 2020 10:15 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/3 "2020-12-08T10:15:59Z")

</div>

Yes - sometimes I wonder if there is a reason we write docs... 😢[https://nodered.org/docs/getting-started/local](https://nodered.org/docs/getting-started/local)

---

<div class="post-metadata">

**Author:** ![stefan2210](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@stefan2210](https://discourse.nodered.org/u/stefan2210)\
**Post date:** [8 December 2020 11:20 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/4 "2020-12-08T11:20:04Z")

</div>

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

```auto
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](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:

```auto
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
     echo "deb https://dl.yarnpkg.com/debian/ 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:
  nodejs
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 https://deb.nodesource.com/node_12.x 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 https://github.com/request/request/issues/3142
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): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.6/bcrypt$
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/obj.target/bcrypt_lib/src/blowfish.o
make: g++: Command not found
bcrypt_lib.target.mk:113: recipe for target 'Release/obj.target/bcrypt_lib/src/blowfish.o' failed
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] 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`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ node-red@1.2.6
added 354 packages from 321 contributors in 24.118s
1.2.6
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

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 December 2020 11:50 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/5 "2020-12-08T11:50:30Z")

</div>

That looks a lot better - at least you are now on a supported version of nodejs 🙂  
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`

---

<div class="post-metadata">

**Author:** ![stefan2210](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@stefan2210](https://discourse.nodered.org/u/stefan2210)\
**Post date:** [8 December 2020 12:52 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/6 "2020-12-08T12:52:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 February 2021 12:52 UTC](https://discourse.nodered.org/t/installation-of-node-red-on-ubuntu-18-04-server/37173/7 "2021-02-06T12:52:03Z")

</div>

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