If you have installed Node-RED as a global npm package, you can use the
$ node-red Welcome to Node-RED =================== 25 Jun 22:51:09 - [info] Node-RED version: v0.17.4 25 Jun 22:51:09 - [info] Node.js version: v6.11.1 25 Jun 22:51:09 - [info] Loading palette nodes 25 Jun 22:51:10 - [warn] ------------------------------------------ 25 Jun 22:51:10 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node 25 Jun 22:51:10 - [warn] ------------------------------------------ 25 Jun 22:51:10 - [info] Settings file : /home/nol/.node-red/settings.js 25 Jun 22:51:10 - [info] User Directory : /home/nol/.node-red 25 Jun 22:51:10 - [info] Server now running at http://127.0.0.1:1880/ 25 Jun 22:51:10 - [info] Creating new flows file : flows_noltop.json 25 Jun 22:51:10 - [info] Starting flows 25 Jun 22:51:10 - [info] Started flows
You can then access the Node-RED editor at http://localhost:1880.
There are specific instructions available for certain hardware platforms:
You can now create your first flow.
Usage: node-red [-v] [-?] [--settings settings.js] [--userDir DIR] [flows.json] Options: -s, --settings FILE use specified settings file -u, --userDir DIR use specified user directory -v enable verbose output -?, --help show usage
node-red command can still be accessed even if Node-RED hasn’t been installed
as a global npm package.
If you have npm installed Node-RED, this script will be
relative to the directory you ran
npm install in. If you have installed from a
release zip file, the script will be
node-red-X.Y.Z/bin/node-red, relative to
the directory you extracted the zip into.
First make the
node-red start script executable:
chmod +x <node-red-install-directory>/bin/node-red
Then you can start Node-RED with:
On Windows, run the following command from the same directory you ran
in, or that you extracted the release zip file:
By default, Node-RED stores your data in the directory
backwards compatibility reasons, if Node-RED detects user data in its install
directory, it will use that instead. The upgrading documentation
includes a section on migrating your data out of the Node-RED install directory.
To override what directory to use, the
--userDir command-line option can be used.
There are occasions when it is necessary to pass arguments to the underlying node.js process. For example, when running on devices like the Raspberry Pi or BeagleBone Black that have a constrained amount of memory.
To do this, you must use the
node-red-pi start script in place of
Note: this script is not available on Windows.
Alternatively, if are running Node-RED using the
node command, you must provide
arguments for the node process before specifying
red.js and the arguments you
want passed to Node-RED itself.
The following two commands show these two approaches:
node-red-pi --max-old-space-size=128 --userDir /home/user/node-red-data/ node --max-old-space-size=128 red.js --userDir /home/user/node-red-data/
There are many methods of starting, stopping and monitoring applications at boot time. Raspberry Pi users are strongly recommended to follow these instructions.
The guide below sets out what we believe to be the most straight-forward for the majority of users. For Windows, PM2 does not autorun as a service - you may prefer the NSSM option below.
PM2 is a process manager for Node.js. It makes it easy to run applications on boot and ensure they are restarted if necessary.
sudo npm install -g pm2
sudois required if running as a non-root user on Linux/OS X. If running on Windows, you will need to run in a command shell as Administrator, without the
tail.exeis on your path, as described here.
If you have done a global install of node-red, then on Linux/OS X the
command will probably be either:
which node-red can be used to confirm the location.
If you have done a local install, it will be
relative to where you ran
npm install from.
The following command tells PM2 to run Node-RED, assuming
the location of the
-- argument must appear before any arguments you want to pass to node-red.
pm2 start /usr/bin/node-red -- -v
pm2 start /usr/bin/node-red --node-args="--max-old-space-size=128" -- -v
This will start Node-RED in the background. You can view information about the process and access the log output using the commands:
pm2 info node-red pm2 logs node-red
More information about managing processes under PM2 is available here.
PM2 is able to generate and configure a startup script suitable for the platform it is being run on.
Run these commands and follow the instructions it provides:
pm2 save pm2 startup
for newer Linux systems that use systemd use
pm2 startup systemd
export PM2_HOME="/root/.pm2"to point at the correct directory, which would be like:
Finally, reboot and check everything starts as expected.
There are many alternative approaches. The following are some of those created by members of the community.