There are three basic approaches to installing Node-RED. Which of these is “best” for you will depend on your knowledge, willingness to learn, desire or need to gain maximum flexibility and so on. Only you can work that out. It should also be noted that you should be able to mix and max these approaches if you really want to (though I can’t say that I would personally recommend that).
Global Install 🔗︎
- This is the standard and therefore arguably by far the easiest installation.
- It is good for people who are not overly familiar with their OS’s filing system or how node.js and npm work and who don’t want to be bothered to find out (that is not a criticism by the way).
- It allows for multiple instances to be run if needed but all instances must use the same version of Node-RED.
- It doesn’t “pollute” your home folder with the node-red and many other required node.js modules.
- It is standard and most tutorials and explanations assume that this is the way it is installed.
- It makes the node-red command global so you can run it from anywhere.
Best for beginners unless you are prepared to learn about Node.js.
Less flexible and possibly a little less secure. Not the best for “production” installations. Can confuse beginners into installing other Nodes and packages into global when they shouldn’t. Hard to work out where the global files are.
Local Install 🔗︎
- This is a more “node.js way” of installing - global installations being good for exposing global commands but may sometimes be less secure.
- It is a more self-contained installation. Everything can be in 1 place under a single folder structure. This makes it easier to back-up everything together. But it doesn’t force you to work this way, you can keep your userDir folder separate if you like.
- It allows you to run different instances of Node-RED using different versions. Good for testing major Node-RED upgrades and for testing custom nodes or flows against different versions.
- You are in control. You know where everything is because you chose to put it there.
- You control access to all files and folders and so this can be a more flexible installation. You could also have different instances of node-red on the same device with different folder/file access levels. Possible development and test instances on the same device.
- A good way to create a more portable installation of Node-RED since the whole folder structure can be easily copied/archived, etc.
- It is my personal belief that this is also the best approach for people who want to learn how Node.js and/or Node-RED works. But then again, maybe that’s just my warped mind!
Best for flexibility and control. Good for control of security. Best for running different versions of Node-RED in parallel on one device. Good for ease of backup/recovery and for creating distributable copies of a Node-RED application. Best for embedding Node-RED into an existing or new Node.js app.
Requires some knowledge of how Node.js and npm work.
Containerised Install 🔗︎
- Uses either Docker or snap to containerise the installation.
- Isolates Node-RED from the host OS.
- Allow running multiple, independent instances of Node-RED, possible using different versions.
Best for enterprise use where containerisation is already well supported.
Adds significant hidden complexity and requires good knowledge of the container technology to isolate and fix issues. Also likely to have higher resource requirements than running separate instances in other ways. Experience from the Node-RED forum suggests that a decent knowledge of Docker/snap is recommended.
There is some additional information that I wrote in a recent blog post: