How can I change the default $HOME/.node-red folder location from the source code?

I like to install multiple instances of Node-RED with a single user on Linux. For doing that, I used to get Node-RED source code from GitHub and then using Visual Studio I substituted all .node-red words inside its source code with .node-red2 or something else. Well, that used to work in the past but I tried doing the same and it doesn't work with version 2.2.2.

After running npm install and npm start I receive the following message:

> node-red@2.2.2 start
> node packages/node_modules/node-red/red.js

9 Apr 16:10:09 - [info] 

Welcome to Node-RED
===================

9 Apr 16:10:09 - [info] Node-RED version: v2.2.2
9 Apr 16:10:09 - [info] Node.js  version: v16.14.2
9 Apr 16:10:09 - [info] Linux 5.4.0-107-generic x64 LE
9 Apr 16:10:09 - [info] Loading palette nodes
9 Apr 16:10:10 - [info] Worldmap version 2.28.0
9 Apr 16:10:10 - [info] Dashboard version 3.1.3 started at /ui
9 Apr 16:10:10 - [info] Settings file  : /home/user/.node-red/settings.js
9 Apr 16:10:10 - [info] HTTP Static    : /home/user/.node-red/static
9 Apr 16:10:10 - [info] Context store  : 'default' [module=memory]
9 Apr 16:10:10 - [info] User directory : /home/user/.node-red
9 Apr 16:10:10 - [warn] Flows file name not set. Generating name using hostname.
9 Apr 16:10:10 - [info] Flows file     : /home/user/.node-red/flows_lavos.json
9 Apr 16:10:10 - [error] Uncaught Exception:
9 Apr 16:10:10 - [error] Error: listen EADDRINUSE: address already in use 0.0.0.0:1880
    at Server.setupListenHandle [as _listen2] (node:net:1330:16)
    at listenInCluster (node:net:1378:12)
    at doListen (node:net:1516:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

In fact, the address 1880 is already in use with a different instance of node-red. But what bugs me is that it's looking at the folder /home/user/.node-red/flows_lavos.json and not /home/user/.node-red2/flows_lavos.json. What am I missing? I'm sure that all .node-red words on Node-RED's source code were substituted by .node-red2. Is there any extra procedure or a different way of accomplishing the same?

There is no need to change the source code.

Start Node-RED with the -u argument to tell it what directory you want it to use.

https://nodered.org/docs/getting-started/local#command-line-usage

1 Like

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