Installing and Starting Node-Red

Installing Node Red

Node-Red is a node application and before you Install node red you will need to first install node. Here are the instructions:

Then you can Install node red on Windows and Linux (including raspberry pi) using:

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

Using the -g option adds the node-red command to your path. On linux you will need the sudo option. See the documentation.for more details.

Node-Red on Pi Notes:

Node red is already installed on Raspberry pi but npm (node package manager) isn’t.

You may need to upgrade node-red which you can do by doing an install using npm but you will need to install npm first. This you can do using:

sudo apt-get update
sudo apt-get install npm

Note: npm install failed on my pi and I had to use this command first:

sudo apt-get install -y build-essential

You can check the versions of npm,node and node-red using:

npm -v
node -v
node-red --help

However Raspberry pi provide an install script which can be used for installing and upgrading node-red on the pi and I recommend using it. The procedure for download and using it are here.

I recommend you copy the command from the page and paste it into your command prompt.

Starting Node Red

To start node red on Windows go to a command prompt and type:


if you installed node-red using the -g option.
Note: you may need to change into the node directory.

If it fails you can use:

node c:\node\node_modules\node-red\red.js

On Linux:

Firstly running node by typing node may not work as apparently node is a short cut to nodejs and the short cut may not be present.


In addition there appears to be a naming conflict with another package. see this explanation

The screen shot show how to create the symbolic link


Now that node is working you can run node-red.

Type node-red at the command prompt

. If that doesn’t work it’s probably because the link isn’t configured as shown above. You can try the alternative.

nodejs /usr/local/bin/node-red

As shown below


At the top of the screen you can see the version of node and node-red that you are using and the location of the flows..

At the bottom of the screen it tells you the url to use to access the node-red web admin interface which you use to create your flows.


This console stays open and you will find it useful as when you start creating flows as you will see log information appearing there.

Starting Node-Red as a Service

On Raspberry pi you can also start node-red using:

which starts node-red as daemon.

to stop it use:

and to view the log files type


Starting Node-Red on Boot

If it isn’t already configured you can automatically start node-red on system start by using the command:

sudo systemctl enable nodered.service

and disable it using:

sudo systemctl disable nodered.service

When running on start up you can stop it using the node-red-stop command and restart using node-red-start command.

If you want to load node-red on startup with a different settings file than the settings.js you will need to edit the file /lib/systemd/system/nodered.service.

un-comment the line ExecStart if not already done and the Environment=”NODE_RED_OTPIONS=-v” line to something like:

Environment="NODE_RED_OPTIONS=-s /home/pi/.node-red/mysettings.js"

then reboot.

Node-Red Start Process Overview

When node-red starts it first loads the settings file settings.js which is used to set the admin port, user directory, and flows file etc. The start process is illustrated below. Node-Red-Start-Process

Node-Red Settings

Node-red uses a settings file called settings.js.

On Linux it is located in the /usr/lib/node_modules/node-red/ folder by default. on Windows it is located in c:\node-install-directory\node_modules\node-red\ .

On Linux the settings.js file is copied from the /usr/lib/node_modules/node-red/ folder to your .node-red folder in your home directory when you start node-red, and there is no settings.js file present.

You can create your own settings file and customise it either by copying the existing file or using the file available from Github here.

To use your own settings file use the -s switch when starting node-red e.g.

node-red -s mysettingsfile.js

Important -If you place a settings.js in the .node-red folder then that will be used by default.

The documentation here takes your through the settings file in detail.

The .node-red Folder

On both Windows and Linux user settings and flows are stored in the .node-red folder. This folder is located in the users home folder.

E.G For user steve on windows and on Linux

c:\users\steve\.node-red ——–Windows


/home/steve/.node-red ……….. Linux

Node-red Flows Files and Storage

Node red flows are stored in a .json file in the .node-red folder.

By default this file is called flows_machine_name.json. For example my windows machine is called ws6 and the default flows file is called flows_ws6.json.

New modules that you install are installed under the node_modules folder in the user directory which by default is .node-red.

Useful Command line Options

Node red has a very limited number of command line options. Use:

node-red -h


The -v switch turns on verbose mode.

The -p switch will let you change the port that node-red admin interface uses.

You can use this option to quickly and easily run multiple instances of node-red.

In version 2.0 a safe mode has been added to allow you to start node-red without deploying any flows.

This is very useful if a flow is stopping node-red from running.

node-red --safe

In version 3 a start stop button has been added to the deploy menu so you can pause a flow and then restart it.


To use a different flow file than the default you can use

node-red myflow.json

Because you haven’t specified a settings file it uses the default settings file.

Running Multiple node-red instances for Same User

This you can use for starting multiple flows using different ports and different flow files as shown below.

node-red flow1.json -p 2000
node-red flow2.json -p 2002

Running Multiple node-red instances for Different Users

It is possible to run multiple node-red instances on a single machine for differnet users.

To do that you will need to give each instance a different admin port and also a different user directory or alternatively create and use a new settings file.

You can do this using the -p and -u switches when starting node-red e.g

node-red -p 1881 -u user1

the admin port is 1881 and the user directory is user1 the flow file name uses the default flow name.

Note: If you don’t use a different user directory then they will all use the same flows file which could result in conflicts.

Unless you also use different flow file names as shown previously

If you create a new settings file e,g mysettings.js you can then edit the line starting with flows and remove the two forward slashes.

// flowFile: my’flows.json’,

You could also change the port by editing the line near the top of the file

uiPort: process.env.PORT || 1880,


uiPort: process.env.PORT || 1888,

To use port 1888

You then use the command:

node-red -s mysettings.js

to start the flow.

You could also use the command

node-red -s mysettings.js  -p 1889

to use a different port.

Using the -user option creates a brand new node-red environment under the user folder.So

node-red -p 1881 -u steve

creates a folder called steve with a new settings file etc as shown in the screen shot:


Video Node Red Flow and Startup Files

========>How to use the Admin Interface, nodes and flow basics.

Personal Notes

Because I frequently work on multiple flows at the same time I use the flows file option:

node-red flow1.json -p 2000
node-red flow2.json -p 2002

as I find it easier and quicker.

Related Tutorials and Resources:

Click to rate this post!
[Total: 2 Average: 5]


  1. P.S. just saw the reference to starting services on boot – so wondering if I can simply duplicate that to start the two instances at the same time.

    Environment=”NODE_RED_OPTIONS=-s /home/pi/.node-red/mysettings.js”

    1. Don’t know but looks interesting I will have to give it a try.I think you will need to files node-red.service and node-red2.service and specify the port in the node-ed options
      Environment=”NODE_RED_OPTIONS=-p 2000″

      If you try it before me let me know

      1. I got this response from the node-red forum:
        “You need a service file for each instance. Then you can individually control them, and they will individually restart in the case of crashes.”

  2. Hi Steve,

    Thanks so much for the guides – followed its to get another instance running: duplicate settings file, different port, mapped to different subdomain (nginx). Now trying to figure out how I can have it start automatically like my primary instance (that was installed via the pi script, running as a service).

    Thanks again!

  3. Thanks Steve for your details,
    also seems some points have changed. Just noticed my installation runs a newer version with these options:

    Node-RED v3.0.2
    Usage: node-red [-v] [-?] [–settings settings.js] [–userDir DIR]
    [–port PORT] [–title TITLE] [–safe] [flows.json]
    node-red admin [args] [-?] [–userDir DIR] [–json]

    -p, –port PORT port to listen on
    -s, –settings FILE use specified settings file
    –title TITLE process window title
    -u, –userDir DIR use specified user directory
    -v, –verbose enable verbose output
    –safe enable safe mode
    -D, –define X=Y overwrite value in settings file
    -?, –help show this help
    admin run an admin command

    For this, using another port with -p 2000 (for example) is fine, but passing a ‘userflow.json’ doesn’t seem to be possible, or is it tricky?
    Also with the newly introduced ‘projects’ you have to look closer.
    If I use the default port with ‘node-red’ only, I get:
    12 Jan 21:18:23 – [info] Node-RED version: v3.0.2
    12 Jan 21:18:23 – [info] Node.js version: v19.3.0
    12 Jan 21:18:23 – [info] Linux 5.10.103-v7+ arm LE
    12 Jan 21:18:28 – [info] Loading palette nodes
    12 Jan 21:18:34 – [info] Dashboard version 3.3.0 started at /ui
    12 Jan 21:18:35 – [info] Settings file : /home/pi/.node-red/settings.js
    12 Jan 21:18:35 – [info] Context store : ‘default’ [module=memory]
    12 Jan 21:18:35 – [info] User directory : /home/pi/.node-red
    12 Jan 21:18:35 – [info] Projects directory: /home/pi/.node-red/projects
    12 Jan 21:18:35 – [info] Server now running at
    12 Jan 21:18:35 – [info] Active project : redStuff
    12 Jan 21:18:35 – [info] Flows file : /home/pi/.node-red/projects/redStuff/redStuff.flow.json
    12 Jan 21:18:35 – [warn] Using unencrypted credentials
    12 Jan 21:18:36 – [info] Starting flows
    12 Jan 21:18:36 – [info] Started flows
    12 Jan 21:18:36 – [info] [mqtt-broker:1826333333971f0] Connected to broker: mqtt://rpi:1883
    Here NR works with a ‘project’ setting configured in previous NR usage.
    Interesting, starting with “node-red -p 2000” not having ‘projects’ and it was not possible to enable it within the NR editor!
    13 Jan 00:02:10 – [info] User directory : /home/pi/.node-red/projects/dMQTTdevices
    13 Jan 00:02:10 – [warn] Projects disabled : editorTheme.projects.enabled=false
    13 Jan 00:02:10 – [info] Flows file : /home/pi/.node-red/flows.json
    The ‘Flows file’ names seems to be set by NR. As you can see in the startup options, there is no option for this. Note if the option “Project” is activated, how then the path name is built.

      1. Not sure about y Q “the Github projects feature you are trying to use?”
        Can you give a link for what you have in mind?

  4. Is it possible to install Node-RED on Windows NOT in the home folder?
    My problem is, that from time to time Windows deletes the user folders and creates a new profile, mostly after an Windows update.

    1. You should be able to simply copy the entire folder to another folder and run it from there. I haven’t tried it as I use node-red on linux. Let me know how you get on.

  5. Thanks for helping to start with node-red … your pages are very good for a NR newbie like me.
    After building the first flows and starting them with :1880/ui I noticed I can’t work on a second, different flow/project. Your mentioned method with a second port may work, but I can’t figure out where the first/current flows are stored.
    I’m on an RPI and use the standard user ‘pi’. The directory .node-red hasn’t any new flows.json files. Also searching the complete /home directory doesn’t give any other.
    Any further advice?

    1. Sorry, my mistake!
      I had loaded a flow from another application and defined it as a ‘project’. In the meantime I deleted this flow, but didn’t realize that the project is still in the .node-red directory.
      All my new flows I defined are kept inside that ‘Project’.
      I guess I can use this for the setup with multi port/session.

    2. I think they might have changed the default naming scheme. However they should be stored in the .node-red folder.
      Do a listing for *.json.
      Because I have many flows that I work I I start them all by name so I use
      node-red test.json -p 2000 //starts with test.json file on port 2000
      node-red clients.json – p 2016 //
      node-red // starts on port 1880 using default flow file

      note when node-red loads it should show the flow file it is using with the complete path.

  6. Hi Steve,

    I think there is a typo on your site:
    ‘node-modules’ should be replaced by ‘node_modules’

    Kind regards from

  7. C:\Windows\System32>node-red
    Der Befehl “node-red” ist entweder falsch geschrieben oder konnte nicht gefunden werden.

    1. Provided you have installed it then fo to the .node-red folder in your my documents folder and run it from there.Let me know how you get on.

  8. Hello Steve,
    I have created a copy of the .node-red folder and named it as .node-red-test. This allows me to have a separate instance for testing purposes. For each instance, I use a different command line:
    – node-red
    – node-red -p 1881 -u c:/alberto/.node-red-test.

    All works as designed, however, wondering how to update node-red on each of these instances. I guess that sudo npm install -g –unsafe-perm node-red will act only on the default .node-red folder, correct ?

    Thank you

    1. I think if you run the command
      npm install –unsafe-perm node-red
      in the node-red-test folder it will update the one you want but I haven’t tried it.

  9. My son is trying to install red node after successful install when he goes to run the program it opens up a text file and that’s all he gets he can’t do anything else, please advise, my son’s really bummed out because he’s building a project and he has done the physical part of it but he needs to add the electronic side, thank you.

  10. Hello Steve,
    I tried to install node-red and got this message: What went wrong, how can I avoid this?
    I did not understand the information in the issue.
    Thanks in advance

    C:\Users\Frank>npm install -g –unsafe-perm node-red
    npm WARN deprecated request@2.88.0: request has been deprecated, see
    C:\Users\Frank\AppData\Roaming\npm\node-red -> C:\Users\Frank\AppData\Roaming\npm\node_modules\node-red\red.js
    C:\Users\Frank\AppData\Roaming\npm\node-red-pi -> C:\Users\Frank\AppData\Roaming\npm\node_modules\node-red\bin\node-red-pi
    + node-red@1.0.5
    updated 1 package in 21.166s

      1. Thank you Steve,
        after reinstall node-red seems to work. I got:
        node –version ==> v12.16.2
        npm –version ==> 6.14.4
        Node-RED version: v1.0.5
        in Win10 prompt and node-red message
        “Server now running at
        in terminal window. I hope thats fine to start?
        Best regards

  11. Steve,
    Thanks for all you do. Your site is of great value.
    For windows, I am trying to specify a nodes directory in that I have sub folders for all my “users” but I want them all to use a common folder for my nodes.
    When I start up each unique instance of node-red, it is reading the settings files but complaining that it cant find the custom nodes.
    nodesDir: ‘C:\Users\MyUserName\.node-red’,
    userDir: ‘C:\Users\MyUserName\.node-red\RHI’

    1. Hi
      Can you send me a screen shot of the message. Are there any permissions issues on the folders? When you say users are they accessing across a network?

  12. Hi Steve!
    Thanks for your site. I try to run 2 instances of node-red, one for the adults and one for the kids:-)
    So, first my old instance is starting automatically with “sudo systemctl enable nodered.service”. This ist listening in port 1880. The second instance i started with “node-red -p 1881 -u kids”. All works fine, but how can I make this command autostarting like my first instance?
    Hope you can give me a hand to solve that problem.
    Regards Simon

    1. Hi
      Assuming you are on Linux/Pi then I would try the pm2 script see
      I would also use a separate JSON flows file using the -s kids.json option as it stops them changing the flows in the main instance.
      It is actually on my to do list as I run several instances for testing and client flows.
      Let me know how you get on or if you have any problems

      1. Hi Steve
        Thanks for your reply. Will try it tomorrow, first i have to make a copy of my sd-card with a running configuration 😉
        I suggest, that the command will be

        pm2 start /usr/bin/node-red — -p 1880 -u adults
        pm2 start /usr/bin/node-red — -p 1881 -u kids
        pm2 save
        pm2 startup systemd

        Could that work?
        Regards Simon

  13. Hi Steve!
    Great site and very informative, I’ve been following for about a year and has helped tremendously!
    One question about node-red settings.js. it’s not clear how to go about reloading the settings.js file.
    after making changes. It seems that a simple [Deploy] of node-red flows wont do the trick.

    Do you have to stop and start the node-red service ` service node-red start | stop| reload`
    or is there any way you know of to reload the settings file without having to re-initialize node-red?

  14. Awesome site and content Steve.
    Very easy to follow for beginners like me and very very much appreciated.

  15. Hi Steve, great website .
    I got question regarding using Node-red to read data via Ethernet port from some TCP “slave”. Device I use (with Windows OS) has two physical Ethernet ports. Each port can be configured independently from the other ( IP address, DHCP or Fixed) . Can i read data from any of two physical Ethernet ports using Node red? I’m note quite sure how that part would work , Node red with two ports. Would appreciate any help or if you can point to some info.

  16. Hi,

    I found your page hope you can help me. I have a synology nas and installed the node-red. My problem is only run it from console, and when close the console the node red is turning off too. For me what you write:

    “Starting Node-Red as a Service
    You can also start node-red using:
    which starts node-red as daemon.”

    not working, because the console show this: node-red-start: command not found
    I found another page can start it with pm2 but it isn’t working too. 🙁 After install pm2 the console show me the same message pm2: command not found. How can I run in the background the node-red? Please help!

Leave a Reply

Your email address will not be published. Required fields are marked *