| layout | docs-getting-started | |
|---|---|---|
| toc | toc-user-guide.html | |
| title | Running on Raspberry Pi | |
| slug | raspberry pi | |
| redirect_from |
|
We provide a script to install Node.js, npm and Node-RED onto a Raspberry Pi, and other platforms running a Debian based OS. The script can also be used to upgrade an existing install when a new release is available.
Running the following command will download and run the script. If you want to review the contents of the script first, you can view it on Github.
bash <(curl -sL https://github.com/node-red/linux-installers/releases/latest/download/install-update-nodered-deb)
There are extra parameters you can pass to the script. Add --help to the end of the above command to see them.
sudo apt install build-essential git curl
first to ensure npm is able to fetch and build any binary modules it needs to install.
This script will:
- remove the existing version of Node-RED if present.
- if it detects Node.js is already installed, it will ensure it is at least v20. If nothing is found it will install the Node.js v22 LTS release using the NodeSource package.
- install the latest version of Node-RED using npm.
- optionally install a collection of useful Pi-specific nodes.
- setup Node-RED to run as a service and provide a set of commands to work with the service.
As with running Node-RED locally, you can use
the node-red command to run Node-RED in a terminal. It can then be stopped
by pressing Ctrl-C or by closing the terminal window.
Due to the limited memory of the Raspberry Pi, you may need to start Node-RED with an additional argument to tell the underlying Node.js process to free up unused memory sooner than it would otherwise.
To do this, you should use the alternative node-red-pi command and pass in the
max-old-space-size argument.
node-red-pi --max-old-space-size=256
The install script also sets it up to run as a service. This means it can run in the background and be enabled to automatically start on boot.
The following commands are provided to work with the service:
node-red-start- this starts the Node-RED service and displays its log output. PressingCtrl-Cor closing the window does not stop the service; it keeps running in the background. Usenode-red-logto re-attach and view the log.node-red-stop- this stops the Node-RED servicenode-red-restart- this restarts the Node-RED servicenode-red-reload- this stops then starts the Node-RED servicenode-red-log- this displays the log output of the service
You can also start the Node-RED service on the Raspberry Pi OS Desktop by selecting
the Menu -> Programming -> Node-RED menu option.
If you want Node-RED to run when the device is turned on, or re-booted, you can enable the service to autostart by running the command:
sudo systemctl enable nodered.service
To disable the service, run the command:
sudo systemctl disable nodered.service
Once Node-RED is running you can access the editor in a browser.
If you are using the browser on the Pi desktop, you can open the address: http://localhost:1880.
When browsing from another machine you should use the hostname or IP-address of the Pi: http://<hostname>:1880. You
can find the IP address by running hostname -I on the Pi.