Starting node-red

Hello, i normally start node-red with my computer {local}
but today i want to start with
16 Mar 06:45:55 - [info] Node-RED version: v1.2.9
16 Mar 06:45:55 - [info] Node.js version: v15.10.0
16 Mar 06:45:55 - [info] Windows_NT 10.0.19041 x64 LE
16 Mar 06:45:56 - [info] Loading palette nodes
16 Mar 06:45:57 - [info] Settings file : C:\Users\Nutzer.node-red\settings.js
16 Mar 06:45:57 - [info] Context store : 'default' [module=memory]
16 Mar 06:45:57 - [info] User directory : C:\Users\Nutzer.node-red
16 Mar 06:45:57 - [warn] Projects disabled : editorTheme.projects.enabled=false
16 Mar 06:45:57 - [info] Flows file : C:\Users\Nutzer.node-red\flows_DE12785648H7.json
16 Mar 06:45:57 - [error] Uncaught Exception:
16 Mar 06:45:57 - [error] Error: listen EADDRINUSE: address already in use
at Server.setupListenHandle [as _listen2] (node:net:1310:16)
at listenInCluster (node:net:1358:12)
at doListen (node:net:1496:7)
at processTicksAndRejections (node:internal/process/task_queues:82:21)

You already have your other instance running on port 1880. You can't use the same port twice.

Either stop the other one automatically starting with your computer, or try using -p to specify another port.
You also have to take care of the workspace, usually .node-red in your user dir. Only one instance can use it at a time.
So you'd have to pass an alternative directory using the -u parameter as well.

node-red -p 1881 -u [path/to/workspace]

But last 2 month i just started like this and everything works. how can i stop the other than? I only use node-red on this port..

This looks very similar to this >> Start up error - Uncaught Exception - #6 by Steve-Mcl

Try the advice in that thread.

I just closed all windows and startet my PC new -> than it works normally

Hi, always with regard of starting node-red, I've noticed two different behavior on windows and raspberry, running node-red from command line in this way:

  • windows: node-red -u C:\Users\me\.node-red\test1 -p 1801 flow_test.json
  • raspberry: node-red -u home/pi/.node-red/test1 -p 1801 flow_test.json

Inside the test1 folder there is no settings.js, but:
on windows it's used the settings.js file in .node-red folder
on raspberry a new default settings.js file is created inside the test1 folder

Windows 10, node-red v1.2.9, node v14.15.4
Raspberry pi3 B+, debian buster, node-red v1.2.9, node v12.21.0

Is it the same if you launch with forward slashes?

node-red -u C:/Users/me/.node-red/test1 -p 1801 flow_test.json

It's definitely the backslash issue on Windows. Just tripped over it again by accident yesterday.

Always use forward slashes / or double backslashes \\. Don't press TAB by accident like I did, it will replace all slashes with backslashes again. :see_no_evil:

Yes, it's the same. On windows it always use the settings.js file inside .node-red with all the commands (if it doesn't find the file in test1, of course):
node-red -u C:\Users\me\.node-red\test1 -p 1801 flow_test.json
node-red -u C:\\Users\\me\\.node-red\\test1 -p 1801 flow_test.json
node-red -u C:/Users/me/.node-red/test1 -p 1801 flow_test.json

I'm understanding that for you this is not what expected. Actually, this is what I would like to have on raspbian, too :grimacing: :grimacing: :grimacing:

Could you also try...

node-red -u C:\Users\me\.node-red\test1\ -p 1801 flow_test.json
node-red -u "C:\Users\me\.node-red\test1" -p 1801 flow_test.json
node-red -u "C:\Users\me\.node-red\test1\" -p 1801 flow_test.json

node-red -u C:\\Users\\me\\.node-red\\test1\\ -p 1801 flow_test.json
node-red -u "C:\\Users\\me\\.node-red\\test1" -p 1801 flow_test.json
node-red -u "C:\\Users\\me\\.node-red\\test1\\" -p 1801 flow_test.json

node-red -u C:/Users/me/.node-red/test1/ -p 1801 flow_test.json
node-red -u "C:/Users/me/.node-red/test1" -p 1801 flow_test.json
node-red -u "C:/Users/me/.node-red/test1/" -p 1801 flow_test.json

The logic for finding the settings file to use is quite complex, if a the user dir is specified but the settings file does not exist there then it uses various environment vars to find it. I don't know what the logic behind that is. I guess that the two machines differ in the env settings.

if (parsedArgs.settings) {
    // User-specified settings file
    settingsFile = parsedArgs.settings;
} else if (parsedArgs.userDir && fs.existsSync(path.join(parsedArgs.userDir,"settings.js"))) {
    // User-specified userDir that contains a settings.js
    settingsFile = path.join(parsedArgs.userDir,"settings.js");
} else {
    if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".config.json"))) {
        // NODE_RED_HOME contains user data - use its settings.js
        settingsFile = path.join(process.env.NODE_RED_HOME,"settings.js");
    } else if (process.env.HOMEPATH && fs.existsSync(path.join(process.env.HOMEPATH,".node-red",".config.json"))) {
        // Consider compatibility for older versions
        settingsFile = path.join(process.env.HOMEPATH,".node-red","settings.js");
    } else {
        var userDir = parsedArgs.userDir || path.join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,".node-red");
        var userSettingsFile = path.join(userDir,"settings.js");
        if (fs.existsSync(userSettingsFile)) {
            // $HOME/.node-red/settings.js exists
            settingsFile = userSettingsFile;
        } else {
            var defaultSettings = path.join(__dirname,"settings.js");
            var settingsStat = fs.statSync(defaultSettings);
            if (settingsStat.mtime.getTime() <= settingsStat.ctime.getTime()) {
                // Default settings file has not been modified - safe to copy
                settingsFile = userSettingsFile;
            } else {
                // Use default settings.js as it has been modified
                settingsFile = defaultSettings;

All the instruction, apart for the 3rd one, work as the same, using the settings.js file inside ".node-red" directory if it doesn't exist in "test1"

For the 3rd instruction
node-red -u "C:\Users\me.node-red\test1" -p 1801 flow_test.json
this is the result
30 Mar 02:43:52 - [error] Failed to start server:
30 Mar 02:43:52 - [error] Error: C:\Users\me.node-red\test1" -p 1801 flow_test.json\node_modules contains invalid WIN32 path characters.
at Object.mkdirs (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules\fs-extra\lib\mkdirs\mkdirs.js:18:22)
at C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules\universalify\index.js:13:12
at new Promise ()
at Object.mkdirs (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules\universalify\index.js:7:14)
at Object.init (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\storage\localfilesystem\index.js:50:22)
at Object.init (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\storage\index.js:74:34)
at C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\runtime\lib\index.js:118:43
at tryCatchReject (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:845:30)
at runContinuation1 (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:804:4)
at Fulfilled.when (C:\Users\me\AppData\Roaming\npm\node_modules\node-red\node_modules\when\lib\makePromise.js:592:4)

Thanks a lot for the explanation Colin. I'll go through specifying the settings.js file within the launching command.

Always regarding this topic, I'm trying to start a different instance of node-red at boot on a raspberry 3B + with debian stretch, but without success.
I have disabled the default one with "sudo systemctl disable nodered.service", and following is the service file I have created, put in /etc/systemd/system, end enabled. The user is not the default "pi" but "me", user with the same privileges and groups of "pi" and where I have installed node-red (I don't remember if I did it with sudo or nor)

Description=personal Node-RED istance


Environment="NODE_RED_OPTIONS=-u /home/me/.node-red/personal -s /home/me/.node-red/settings.js flows_scada.json"

ExecStart=/usr/bin/env node-red-me $NODE_OPTIONS $NODE_RED_OPTIONS


You haven't said what the problem is. Watch /var/log/syslog when you try to start it and also use
sudo systemctl status yourservicename
to see what it says.

Does node-red-me exist? Is there a reason you are not using node-red-pi?

Oh sorry, you're right Colin.
The problem is that this instance of node-red doesn't start at boot. I have to run it manually every time.
Actually, looking at the log and the status response, it failed because "node-red-rw" desn't exist as you pointed out. I thought it was created when installing node-red as "me" user instead of "pi" user. But if I run "env", I doesn't even see "node-red-pi" in the list.
So, the problem is "ExecStart=/usr/bin/env node-red-me $NODE_OPTIONS $NODE_RED_OPTIONS" related to "node-red-me" that doesn't exist.
How can I fix it?

node-red-pi is what you want. It should exist if you originally installed using the recommended script for the pi from the node-red-docs. Does
which node-red-pi find it?

Yes Colin, thanks a lot. It works :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.