Installing Node-RED on Edge Computer natively (non-docker)

You will need to update npm and node.js in order to install Node-RED natively.

I recommend you do these steps using the root account with the cockpit terminal at port 9090.

https://ip-address:9090

1.0 As always before installing new software perform these commands

apt update
apt upgrade

Then install curl (it might already be installed)

apt install curl

2.0 Install nvm to manage your node.js installation.

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

2.1. Now you can use some nvm commands
for the latest version (version 18.x as of this writing) use

nvm install node

2.2. Node-RED recommends node.js v14.x, so you can install this with the following command

nvm install 14.18.0

2.3 nvm can select specific version of node to use. But be aware that after reboot it will revert to the default version. Read up on nvm to change the default version.

nvm use 14.18.0

image

3.0 Now update npm to the latest version

npm i -g npm@latest

4.0 Now you can install Node-RED

npm install -g —unsafe-perm node-red

5.0 Install PM2

npm install -g pm2

then, find out where node-red is installed:

which node-red

5.1 Add node-red to startup with PM2

pm2 start /root/.nvm/versions/node/v14.18.0/bin/node-red – -v

Personally I went with installing sudo and using the node-red debian/raspbian script which made the install easy as possible.
https://nodered.org/docs/getting-started/raspberrypi
those dependency must also be installed:
build-essential git curl
Last if you need some specific node also check those if they are up to date:
‘g++, python3’
And if you get any error during a node installation, look for a “xxx not found”, 75% of the time it is just a missing dependency.

1 Like

When you installed sudo, did you have trouble with the edge user sudoers file?

I have used the

su -

command to open a root terminal, then used the

apt install sudo

command to install sudo. and last used the

adduser edge sudo

and rebooted the edge computer to make sure everything was ok (not sure if needed in fact)

1 Like

Thanks, I will try that next time!