# Settings.js "Error writing settings.js:Permission denied"

**URL:** https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035
**Category:** General
**Created:** [3 August 2018 22:39 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035 "2018-08-03T22:39:34Z")
**Posts on this page:** 14
**Page:** 2

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [5 September 2019 15:00 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/21 "2019-09-05T15:00:57Z")

</div>

Can you please deinstall node-red, and reinstall following the instructions in the Node-RED docs?  
[https://nodered.org/docs/getting-started/local](https://nodered.org/docs/getting-started/local)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 September 2019 15:21 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/22 "2019-09-05T15:21:32Z")

</div>

Or for Ubuntu you can use the bash installation script provided for the Pi. [https://nodered.org/docs/getting-started/raspberrypi](https://nodered.org/docs/getting-started/raspberrypi)

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [5 September 2019 15:22 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/23 "2019-09-05T15:22:58Z")

</div>

THIS IS (or was) A SNAP INSTALL so is NOT a standard install  
see

> **[dceejay/nodered.snap](https://github.com/dceejay/nodered.snap)**
>
> Node RED snappy package. Contribute to dceejay/nodered.snap development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [5 September 2019 15:37 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/24 "2019-09-05T15:37:18Z")

</div>

Thanks for the link Dave, I'm not familiar _at all_ with snap, thought it just meant a different install path. Learning new things every day 🙂

Based on that, ignore my previous instructions @pcborges  
The following quote is from the README of the repository Dave linked.

> The **settings.js** and **flows.json** file are located in the `/root/snap/node-red/current/` directory.

So to add in the `adminAuth` support, try editing the `settings.js` file in the above path.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [5 September 2019 15:47 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/25 "2019-09-05T15:47:48Z")

</div>

Having said that. The full install is the preferred / most flexible way to install. But the snap should work and we are happy to take improvements if there are any experts out there...

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [5 September 2019 16:16 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/26 "2019-09-05T16:16:25Z")

</div>

Now I can post replies again....🙂

Thanks afelix but the reinstall you suggested above worked ok.  
Node-red is up and running including authentication!  
Thanks  
Paulo

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [5 September 2019 18:19 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/27 "2019-09-05T18:19:06Z")

</div>

People, I thought I was ok but then not that much...

Everything is working good but then I tried to execute:  
sudo systemctl enable nodered.service

And got:  
Failed to enable unit: Unit file nodered.service does not exist.

But then:  
node-red starts node-red sucessfuly.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 September 2019 19:31 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/28 "2019-09-05T19:31:56Z")

</div>

How did you install node-red this time?

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [5 September 2019 20:23 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/29 "2019-09-05T20:23:36Z")

</div>

Uninstalled and then:  
[https://nodered.org/docs/getting-started/local](https://nodered.org/docs/getting-started/local) (sudo npm install -g --unsafe-perm node-red)

Again, everything works ok, including authentication.  
Also it sends data to influxDB flawlessly.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 September 2019 20:29 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/30 "2019-09-05T20:29:17Z")

</div>

If you had used the Pi script I linked to it would have installed the systemd service scripts. If you follow the link at th bottom of that page, Starting node-RED on boot, (which suggests again using the Pi script) then down the bottom is a link to the systemd script as used by the Pi install.

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [5 September 2019 20:36 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/31 "2019-09-05T20:36:56Z")

</div>

So, just to make sure I am in the right track:

sudo npm install -g pm2  
which node-red returns: /usr/bin/node-red  
pm2 start /usr/bin/node-red -- -v  
check with:  
pm2 info node-red  
pm2 logs node-red

What do you think?

Just run the sequence...  
after reboot I run pm2 info node-red and it returns:  
node-red doesn't exist...

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 September 2019 21:06 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/32 "2019-09-05T21:06:13Z")

</div>

No, you are on Ubuntu, use the systemd script I linked to (or use the pi install script). At least that is the usual way.

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [5 September 2019 21:10 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/33 "2019-09-05T21:10:35Z")

</div>

Colin, there are so many alternatives...

Do you mean to use the script:

```auto
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

```

and then:  
sudo systemctl enable nodered.service

Do I have to uninstall?

Because node-red is workin perfect, I just need it to auto start at boot

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 September 2019 21:18 UTC](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035/34 "2019-09-05T21:18:50Z")

</div>

If you just want to add the systemd script for running it as a service then you can do that (I described where to find it) and all should be well. Since you have everything else going as you want that is possibly the best plan.  
Alternatively you could use the `bash <(curl` script which will install it all in one go for you and also give you the commands node-red-start, node-red-stop and node-red-log. You would not need to uninstall the existing node-red. However, as I said, since it is all working then possibly best just to get the systemd script.  
You should check which version of nodejs you have, if you haven't already done that. It should be 8.x or 10.x You can check that by running  
`node -v`  
That is another advantage of the Pi script, it would install a valid version of node.

[Previous page](https://discourse.nodered.org/t/settings-js-error-writing-settings-js-permission-denied/2035.md?page=1)
