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 add node-red command to your path. See the  documentation.for more details.

Starting Node Red

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

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

Note: you may need to change into the node directory.

You should also be able to use the simple:

node-red

if you installed node-red using the -g option.

On Linux:

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

running-node-fail

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

whereisnodejs

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

Type node-red at the command prompt

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

nodejs /usr/local/bin/node-red

As shown below

running-node-red

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 interface which you use to create your flows.

node-red-web-url

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

You can also start node-red using:
node-red-start

which starts node-red as daemon.

to stop it use:
node-red-stop

Node-Red Start Process

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\

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

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

and

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

Other Command line Options

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

node-red -h

node-red-help

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.

Running Multiple node-red instances

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

To do that you will need to give each instance a different admin port and also a different user directory.

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 use directory is user1

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

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



Related Tutorials and resources:

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

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