Starting node-red in debug mode in ubuntu- how to

In windows, i would simply add '--inspect' as an argument to node in C:\Users<username>\AppData\Roaming\npm\node-red.cmd. I am unable to find the shell script in ubuntu- executing 'which node-red' in my ubuntu instance gave me /usr/bin/node-red which is the actual javascript file rather than the shell script used to launch node-red.

The default install on Linux autostarts via systemd so you need to use the systemctl stop node-red command to stop the default instance. Then you can manually start node red using the node-red command.

To make things easier, I recommend editing the ~/.node-red/package.json file and adding some npm scripts including one to manually run NR with the inspect option & ones to stop, start and restart node-red. You might want to also add one to show the node-red log output at the terminal, something like sudo journalctl -u node-red -f -n 0 -o cat.

@uma just to clarify - the above statement is only true if you used our install script. If you manually installed with npm install .... then it will not be setup as a systemd service. In which case, you should find you have a node-red-pi command - this should let you specify the --inspect argument

1 Like