# Problem with settings.js

**URL:** <https://discourse.nodered.org/t/problem-with-settings-js/22923>\
**Category:** General\
**Created:** [10 March 2020 12:45 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923 "2020-03-10T12:45:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [10 March 2020 12:45 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/1 "2020-03-10T12:45:47Z")

</div>

Hi all.  
This morning i've a problem to edit "settings.js" because i've this error:

[Error while reading the lock file ./.settings.js.swp: not enough data read]

How can i resolve it?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 March 2020 15:20 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/2 "2020-03-10T15:20:21Z")

</div>

- What platform/os are you using?
- What version of NR and Node.js? (see NR startup log)
- Was this ever working?
- if it was working, what change did you make?

You can try renaming your settings.js file and then try starting NR again.

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [10 March 2020 18:36 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/3 "2020-03-10T18:36:12Z")

</div>

I would change log configuration in settings.js.

10 Mar 17:29:13 - [info] Node-RED version: v1.0.3  
10 Mar 17:29:13 - [info] Node.js version: v10.19.0  
10 Mar 17:29:13 - [info] Linux 4.19.57+ arm LE

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 March 2020 18:43 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/4 "2020-03-10T18:43:34Z")

</div>

> [@gianluca.ginoble](#):
>
> I would change log configuration in settings.js.

I don't understand? Are you saying you did change settings.js? If so, try undoing your change

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [10 March 2020 18:44 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/5 "2020-03-10T18:44:56Z")

</div>

I can't undoing because the file is locked as you can read in my message.  
How can i delete swap file?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 March 2020 18:49 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/6 "2020-03-10T18:49:56Z")

</div>

Are you running on a Pi?  
When does that error show up? i.e. what are you doing when it shows up?  
Have you rebooted the device?

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [10 March 2020 18:51 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/7 "2020-03-10T18:51:54Z")

</div>

Yes, pi.  
I'm doing "nano settings.js", yes i've rebooted but i've not changed the name; is it safe?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 March 2020 18:56 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/8 "2020-03-10T18:56:30Z")

</div>

Ok, so you are using `nano` to edit the file. When do you see the error?

---

<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:** [10 March 2020 19:14 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/9 "2020-03-10T19:14:51Z")

</div>

Delete that file and check that you are not running out of space on the SD card as that is something that can cause the swp file to be corrupted.  
Are you running an up to date version of the operating system? There was a bug in nano a few years ago that could cause that error.

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [10 March 2020 21:43 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/10 "2020-03-10T21:43:19Z")

</div>

Ok Colin but were i can find settings.js.swp file so i can delete it?  
The out of memory in sd card is caused by too many logs in daemon.log and system.log

---

<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:** [10 March 2020 22:01 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/11 "2020-03-10T22:01:43Z")

</div>

I think in the same folder as settings.js, the error you posted said it was .settings.js.swp, so starting with a dot.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 March 2020 22:15 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/12 "2020-03-10T22:15:35Z")

</div>

in the directory (/home/pi/.node-red) do:  
`ls -a`  
and see what you see.  
(or: _post_ what you see.)

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [11 March 2020 09:56 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/13 "2020-03-11T09:56:20Z")

</div>

Ok, i've just removed .settings.js.swp but now settings.js seems to be void.  
I write nano settings.js and there is no data inside.  
How can i restore it?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 March 2020 10:19 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/14 "2020-03-11T10:19:52Z")

</div>

Start up node-red and it should build the file.

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [11 March 2020 10:48 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/15 "2020-03-11T10:48:35Z")

</div>

Settings.js continues to be void also after node-red stop and start

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 March 2020 11:33 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/16 "2020-03-11T11:33:04Z")

</div>

Works for me. Did you remove the settings.js file from your /home/pi/.node-red directory (if not on a pi, from the user directory?

If so, please show your startup log

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [11 March 2020 11:59 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/17 "2020-03-11T11:59:51Z")

</div>

Yes, exactly from this directory.  
This is node-red-log output:

## 11 Mar 11:35:20 - [info] Context store : 'default' [module=memory] 11 Mar 11:35:20 - [info] User directory : /home/pi/.node-red 11 Mar 11:35:20 - [warn] Projects disabled : set editorTheme.projects.enabled=tr ue to enable 11 Mar 11:35:20 - [info] Flows file : /home/pi/.node-red/flows\_raspberrypi.j son 11 Mar 11:35:21 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/) 11 Mar 11:35:21 - [warn]

## Your flow credentials file is encrypted using a system-generated key. If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials. You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

11 Mar 11:35:21 - [info] Starting flows  
11 Mar 11:35:22 - [info] Started flows  
11 Mar 12:11:13 - [info] Stopping flows  
11 Mar 12:11:13 - [info] Stopped flows  
11 Mar 12:11:13 - [info] Starting flows  
11 Mar 12:11:14 - [info] Started flows  
11 Mar 12:15:19 - [info] Stopping flows  
11 Mar 12:15:19 - [info] Stopped flows  
11 Mar 12:15:19 - [info] Starting flows  
11 Mar 12:15:20 - [info] Started flows

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 March 2020 12:03 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/18 "2020-03-11T12:03:48Z")

</div>

what do you get by entering `ls -al $HOME/.node-red/settings.*`

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [11 March 2020 13:16 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/19 "2020-03-11T13:16:00Z")

</div>

-rw-r--r-- 1 pi pi 0 mar 10 13:05 /home/pi/.node-red/settings.js

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [11 March 2020 13:21 UTC](https://discourse.nodered.org/t/problem-with-settings-js/22923/20 "2020-03-11T13:21:19Z")

</div>

Ok, now i've deleted settings.js from node-red folder and after restart i have a new settings.js.

[Next page](https://discourse.nodered.org/t/problem-with-settings-js/22923.md?page=2)
