To install Node-Red globally or not to

In my personal opinion, the only downside is the inability to run Dave’s excellent update script (if you are running on Linux). :smile:

In truth, for beginners at least, your approach is slightly more complex to start. You do, of course, have to translate many install instructions and other help information as most will assume a standard installation.

There is one more disadvantage. You need to create your own startup command. The default installation on Linux at least (certainly on a Raspberry Pi) automatically creates a systemd startup script for you. Installed this way, you have to do that for yourself.

For myself, I’ve long run Node-RED as a standard installation (not global) on my “live” system which is on a Pi. NR is installed in a folder under the default Pi user’s home folder and the userDir for Node-RED (normally ~/.node-red is installed in a folder called .data under Node-RED’s folder.

This makes it very easy to back up the whole thing including Node-RED itself and all the data and modules. Something that has saved me a lot of time and heartache on the few occasions where major updates to Node-RED have caused serious issues (generally doesn’t seem to happen any more! Yay Nick & Dave!) .

The other advantages are that you can run multiple instances of Node-RED in parallel if you wish. Also, those instances can be completely different versions of Node-RED. Great if you need some flows using the latest version but have some legacy flows that don’t yet work on the latest. With the introduction of npx, you could even run different instances using different versions of Node.JS.

The final advantage is that you are not having to use a global npm install which can introduce security issues onto your server platform. Installing locally is the “Node” way and generally always recommended except when installing a Node.JS module that provides a command line interface that you might want to use as a system command.

3 Likes