# Unable to create another node-red instance

**URL:** <https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902>\
**Category:** General\
**Created:** [9 December 2022 05:36 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902 "2022-12-09T05:36:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [9 December 2022 05:36 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902/1 "2022-12-09T05:36:45Z")

</div>

> [@Multiple NodeRed Instances on different Ports - Linux/SystemD](https://discourse.nodered.org/t/multiple-nodered-instances-on-different-ports-linux-systemd/9555/4):
>
> Typically I do ... node-red -u /node-red-1881 -p 1881 Just noticed the -p option is missing from documentation (but it definitely works) Perhaps documentation is out of date? [https://nodered.org/docs/getting-started/running](https://nodered.org/docs/getting-started/running)

I followed the above ☝ post. and using the below 👇 command to create another Node-RED instance.

`node-red -u /node-red-1881 -p 1881`

But got an error 👇

> node:internal/fs/utils:347  
> throw err;  
> ^
> 
> Error: EACCES: permission denied, mkdir '/node-red-1881'  
> at Object.mkdirSync (node:fs:1382:3)  
> at module.exports.makeDirSync (/usr/lib/node\_modules/node-red/node\_modules/fs-extra/lib/mkdirs/make-dir.js:23:13)  
> at handleFilterAndCopy (/usr/lib/node\_modules/node-red/node\_modules/fs-extra/lib/copy/copy-sync.js:35:35)  
> at Object.copySync (/usr/lib/node\_modules/node-red/node\_modules/fs-extra/lib/copy/copy-sync.js:29:10)  
> at Object. (/usr/lib/node\_modules/node-red/red.js:129:20)  
> at Module.\_compile (node:internal/modules/cjs/loader:1155:14)  
> at Object.Module.\_extensions..js (node:internal/modules/cjs/loader:1209:10)  
> at Module.load (node:internal/modules/cjs/loader:1033:32)  
> at Function.Module.\_load (node:internal/modules/cjs/loader:868:12)  
> at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run\_main:81:12) {  
> errno: -13,  
> syscall: 'mkdir',  
> code: 'EACCES',  
> path: '/node-red-1881'  
> }

So I googled and found several links one of which is this **[LINK](https://fahidjavid.com/fix-error-eacces-permission-denied-mkdir/)**  
which said run this to fix

`$ sudo npm install --unsafe-perm=true --allow-root`

but no resolve then I googled some more and did the following

1. npm cache clean ☹ ( **got error** 👇)

> npm ERR! As of npm@5, the npm cache self-heals from corruption issues  
> npm ERR! by treating integrity mismatches as cache misses. As a result,  
> npm ERR! data extracted from the cache is guaranteed to be valid. If you  
> npm ERR! want to make sure everything is consistent, use `npm cache verify`  
> npm ERR! instead. Deleting the cache can only make npm go slower, and is  
> npm ERR! not likely to correct any problems you may be encountering!  
> npm ERR!  
> npm ERR! On the other hand, if you're debugging an issue with the installer,  
> npm ERR! or race conditions that depend on the timing of writing to an empty  
> npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a  
> npm ERR! temporary cache instead of nuking the actual one.  
> npm ERR!  
> npm ERR! If you're sure you want to delete the entire cache, rerun this command  
> npm ERR! with --force.
> 
> npm ERR! A complete log of this run can be found in:  
> npm ERR! /home/scada/.npm/\_logs/2022-12-09T05\_16\_12\_216Z-debug-0.log

1. npm cache clean --force
2. sudo npm install -g npm
3. npm install ☹ ( **got error again** 👇)

> npm ERR! code EACCES  
> npm ERR! syscall open  
> npm ERR! path /home/scada/package-lock.json  
> npm ERR! errno -13  
> npm ERR! Error: EACCES: permission denied, open '/home/scada/package-lock.json'  
> npm ERR! [Error: EACCES: permission denied, open '/home/scada/package-lock.json'] {  
> npm ERR! errno: -13,  
> npm ERR! code: 'EACCES',  
> npm ERR! syscall: 'open',  
> npm ERR! path: '/home/scada/package-lock.json'  
> npm ERR! }  
> npm ERR!  
> npm ERR! The operation was rejected by your operating system.  
> npm ERR! It is likely you do not have the permissions to access this file as the current user  
> npm ERR!  
> npm ERR! If you believe this might be a permissions issue, please double-check the  
> npm ERR! permissions of the file and its containing directories, or try running  
> npm ERR! the command again as root/Administrator.
> 
> npm ERR! A complete log of this run can be found in:  
> npm ERR! /home/scada/.npm/\_logs/2022-12-09T05\_18\_00\_905Z-debug-0.log

Can anyone help me on this. 😩 I've no idea how to solve this.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 December 2022 08:16 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902/2 "2022-12-09T08:16:35Z")

</div>

> [@sahsha](#):
>
> `node-red -u /node-red-1881 -p 1881`
> 
> But got an error 👇
> 
> > node:internal/fs/utils:347  
> > throw err;  
> > ^
> > 
> > Error: EACCES: permission denied, mkdir '/node-red-1881'

Your issue is simple & clearly described. The account you are using does not have permission to create the directory `/node-red-1881`

Try

```auto
sudo mkdir /node-red-1881
sudo chown $USER /node-red-1881
node-red -u /node-red-1881 -p 1881

```

Note.  
If you intend on creating multiple node reds, then I'd recommend creating a parent directory, taking ownership of that directory, then all subsequent instances will just work without having to take ownership.

For example...

```auto
sudo mkdir /node-reds
sudo chown $USER /node-reds
node-red -u /node-reds/node-red-1881 -p 1881
node-red -u /node-reds/node-red-1882 -p 1882
node-red -u /node-reds/node-red-1884 -p 1884

```

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [9 December 2022 08:48 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902/3 "2022-12-09T08:48:23Z")

</div>

thankyou so much 👍

---

<div class="post-metadata">

**Author:** ![sahsha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sahsha/32/43845_2.png) [@sahsha](https://discourse.nodered.org/u/sahsha)\
**Post date:** [9 December 2022 09:55 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902/4 "2022-12-09T09:55:34Z")

</div>

need to ask one more thing. to have these instances auto started.

I need to edit `nodered.service` files present in locations :

`/etc/systemd/system/multi-user.target.wants`  
`/lib/systemd/system`

edit lines -  
existing  
`EnvironmentFile=-/home/scada/.node-red/EnvironmentFile`  
and adding below ([referred link](https://askubuntu.com/questions/1226079/multiple-environmentfiles-for-systemd-service-file)):  
`EnvironmentFile=-/node-reds/node-red-1881/EnvironmentFile`  
`EnvironmentFile=-/node-reds/node-red-1882/EnvironmentFile`  
`EnvironmentFile=-/node-reds/node-red-1883/EnvironmentFile` ([avoiding 1883 instance as suggested in the post](https://discourse.nodered.org/t/node-red-multiple-instances/9787/7))  
`EnvironmentFile=-/node-reds/node-red-1884/EnvironmentFile`  
`EnvironmentFile=-/node-reds/node-red-1885/EnvironmentFile`

Is this correct? Or is there any other way?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 December 2022 10:25 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902/5 "2022-12-09T10:25:13Z")

</div>

No, create a service for each node-red instance.

There are some alternative options listed in the docs: [Starting Node-RED on boot : Node-RED](https://nodered.org/docs/faq/starting-node-red-on-boot#alternative-options)

Otherwise search the internet on how to make and enable a service for your particular operating system.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 December 2022 10:25 UTC](https://discourse.nodered.org/t/unable-to-create-another-node-red-instance/71902/6 "2022-12-23T10:25:52Z")

</div>

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