Problem with settings.js

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?

  • 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.

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

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

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

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?

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

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

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.

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

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

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

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?

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

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

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

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/
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

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

1 Like

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

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