NR Restarting on form fill (Rpi 3b)

I'm running a flow on an RPi 3b and am experiencing an issue where NR restarts whenever a form on the dash is filled in. Below is the log from around the time it happens. Looks like i'm missing something important? Could any one please point me in the right direction to fix?

Welcome to Node-RED
===================
16 Dec 20:22:24 - [info] Node-RED version: v1.3.4
16 Dec 20:22:24 - [info] Node.js  version: v10.24.0
16 Dec 20:22:24 - [info] Linux 5.10.63-v7+ arm LE
16 Dec 20:22:32 - [info] Loading palette nodes
redPlc rpi_gpio driver V1.0.6 (c) Ocean iiot2k@gmail.com
16 Dec 20:22:50 - [info] Worldmap version 2.23.0
16 Dec 20:22:51 - [info] Dashboard version 3.1.2 started at /ui
16 Dec 20:22:51 - [warn] ------------------------------------------------------
16 Dec 20:22:51 - [warn] [node-red-contrib-noble/noble] Error: Cannot find module 'bluetooth-hci-socket'
16 Dec 20:22:51 - [warn] ------------------------------------------------------
16 Dec 20:22:51 - [info] Settings file  : /home/pi/.node-red/settings.js
16 Dec 20:22:51 - [info] Context store  : 'default' [module=memory]
16 Dec 20:22:51 - [info] User directory : /home/pi/.node-red
16 Dec 20:22:51 - [warn] Projects disabled : editorTheme.projects.enabled=false
16 Dec 20:22:51 - [info] Flows file     : /home/pi/.node-red/flows_astroberry.json
(node:2048) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'
(node:2048) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2048) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
16 Dec 20:22:52 - [info] Server now running at http://127.0.0.1:1880/
16 Dec 20:22:52 - [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.
---------------------------------------------------------------------
16 Dec 20:22:52 - [info] Starting flows
16 Dec 20:22:52 - [info] Started flows

What you have shown does not show the problem you describe, but the warning you show does indicate there is a problem. I believe the warning can be triggered by a faulty node. Please edit settings.js (in your .node-red folder) and change the log level to trace (uncomment the line if necessary). Then restart node-red and post the log here.

Only because I was caught out for a while with similar problems:

Check your power supply!

(Try another one if you have one handy.)

I suffered for a few months with weird things happening. A mere power supply change fixed most of the problems.

I don't think a faulty psu will ever cause repeatable issues such as that warning message. A faulty psu will most likely cause random intermittent odd things to happen.

Well, I am saying that very weird things were happening.

It was predictable - just about daily - which is why I was reluctant to believe it is/was the power supply.

Eventually it became so annoying that as a "last resort" I tried a new power supply and the problems stopped.

There were/are other problems, but a lot of the ones that were driving me batty stopped.

Make of that what you will.

After changing the log to trace, I restarted NR and received the below output

Starting as a systemd service.
17 Dec 17:42:16 - [info]
Welcome to Node-RED
===================
17 Dec 17:42:16 - [info] Node-RED version: v1.3.4
17 Dec 17:42:16 - [info] Node.js  version: v10.24.0
17 Dec 17:42:16 - [info] Linux 5.10.63-v7+ arm LE
17 Dec 17:42:24 - [info] Loading palette nodes
redPlc rpi_gpio driver V1.0.6 (c) Ocean iiot2k@gmail.com
17 Dec 17:42:42 - [info] Worldmap version 2.23.0
17 Dec 17:42:42 - [info] Dashboard version 3.1.2 started at /ui
17 Dec 17:42:46 - [warn] ------------------------------------------------------
17 Dec 17:42:46 - [warn] [node-red-contrib-noble/noble] Error: Cannot find module 'bluetooth-hci-socket'
17 Dec 17:42:46 - [warn] ------------------------------------------------------
17 Dec 17:42:46 - [info] Settings file  : /home/pi/.node-red/settings.js
17 Dec 17:42:46 - [info] Context store  : 'default' [module=memory]
17 Dec 17:42:46 - [info] User directory : /home/pi/.node-red
17 Dec 17:42:46 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 Dec 17:42:46 - [info] Flows file     : /home/pi/.node-red/flows_astroberry.json
(node:24422) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'
(node:24422) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24422) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
17 Dec 17:42:47 - [info] Server now running at http://127.0.0.1:1880/
17 Dec 17:42:47 - [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.
---------------------------------------------------------------------
17 Dec 17:42:47 - [info] Starting flows
17 Dec 17:42:47 - [info] Started flows

I then filled in the same form on the dash and received the following output


    at /usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:415:29
    at Array.reduce (<anonymous>)
    at getObjectProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:414:18)
    at getMessageProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:386:12)
    at Object.evaluateNodeProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:614:22)
    at Object.beforeSend (/home/pi/.node-red/node_modules/node-red-dashboard/nodes/ui_form.js:39:34)
    at EventEmitter.handler (/home/pi/.node-red/node_modules/node-red-dashboard/ui.js:287:22)
    at EventEmitter.emit (events.js:203:15)
    at Socket.emit (events.js:198:13)
    at Socket.emitUntyped (/home/pi/.node-red/node_modules/socket.io/dist/typed-events.js:69:22)
    at process.nextTick (/home/pi/.node-red/node_modules/socket.io/dist/socket.js:428:39)
    at process._tickCallback (internal/process/next_tick.js:61:11)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 1.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
17 Dec 17:47:50 - [info]
Welcome to Node-RED
===================
17 Dec 17:47:50 - [info] Node-RED version: v1.3.4
17 Dec 17:47:50 - [info] Node.js  version: v10.24.0
17 Dec 17:47:50 - [info] Linux 5.10.63-v7+ arm LE
17 Dec 17:47:58 - [info] Loading palette nodes
redPlc rpi_gpio driver V1.0.6 (c) Ocean iiot2k@gmail.com
17 Dec 17:48:16 - [info] Worldmap version 2.23.0
17 Dec 17:48:17 - [info] Dashboard version 3.1.2 started at /ui
17 Dec 17:48:18 - [warn] ------------------------------------------------------
17 Dec 17:48:18 - [warn] [node-red-contrib-noble/noble] Error: Cannot find module 'bluetooth-hci-socket'
17 Dec 17:48:18 - [warn] ------------------------------------------------------
17 Dec 17:48:18 - [info] Settings file  : /home/pi/.node-red/settings.js
17 Dec 17:48:18 - [info] Context store  : 'default' [module=memory]
17 Dec 17:48:18 - [info] User directory : /home/pi/.node-red
17 Dec 17:48:18 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 Dec 17:48:18 - [info] Flows file     : /home/pi/.node-red/flows_astroberry.json
(node:24585) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'
(node:24585) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24585) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
17 Dec 17:48:18 - [info] Server now running at http://127.0.0.1:1880/
17 Dec 17:48:18 - [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.
---------------------------------------------------------------------
17 Dec 17:48:19 - [info] Starting flows
17 Dec 17:48:19 - [info] Started flows

This is all way over my head - what does it all mean?

As for the power supply, I'm currently using a usb battery pack with max output of 5v at 2.4A. I have a 5v 3A power supply handy, so I'll test it out to see if it makes a difference. Stay tuned!

(edit: psu rating from 2A to 2.4A)

Just to clear something up.

A bad power supply shouldn't (in your case) be doing that.

I'm saying with my example it would happen maybe once a day.
The machine would just do weird things.

Node-red would change states of things for no apparent reason.
Oh, sorry: what machine is it? 3, 3b, 4?

After changing the power supply, I tested the form again and received this log output

17 Dec 18:04:25 - [red] Uncaught Exception:
17 Dec 18:04:25 - TypeError: Cannot read property 'form1' of undefined
    at /usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:415:29
    at Array.reduce (<anonymous>)
    at getObjectProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:414:18)
    at getMessageProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:386:12)
    at Object.evaluateNodeProperty (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/util.js:614:22)
    at Object.beforeSend (/home/pi/.node-red/node_modules/node-red-dashboard/nodes/ui_form.js:39:34)
    at EventEmitter.handler (/home/pi/.node-red/node_modules/node-red-dashboard/ui.js:287:22)
    at EventEmitter.emit (events.js:203:15)
    at Socket.emit (events.js:198:13)
    at Socket.emitUntyped (/home/pi/.node-red/node_modules/socket.io/dist/typed-events.js:69:22)
    at process.nextTick (/home/pi/.node-red/node_modules/socket.io/dist/socket.js:428:39)
    at process._tickCallback (internal/process/next_tick.js:61:11)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 1.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
17 Dec 18:04:52 - [info]
Welcome to Node-RED
===================
17 Dec 18:04:52 - [info] Node-RED version: v1.3.4
17 Dec 18:04:52 - [info] Node.js  version: v10.24.0
17 Dec 18:04:52 - [info] Linux 5.10.63-v7+ arm LE
17 Dec 18:04:58 - [info] Loading palette nodes
redPlc rpi_gpio driver V1.0.6 (c) Ocean iiot2k@gmail.com
17 Dec 18:05:11 - [info] Worldmap version 2.23.0
17 Dec 18:05:12 - [info] Dashboard version 3.1.2 started at /ui
17 Dec 18:05:12 - [warn] ------------------------------------------------------
17 Dec 18:05:12 - [warn] [node-red-contrib-noble/noble] Error: Cannot find module 'bluetooth-hci-socket'
17 Dec 18:05:12 - [warn] ------------------------------------------------------
17 Dec 18:05:12 - [info] Settings file  : /home/pi/.node-red/settings.js
17 Dec 18:05:12 - [info] Context store  : 'default' [module=memory]
17 Dec 18:05:12 - [info] User directory : /home/pi/.node-red
17 Dec 18:05:12 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 Dec 18:05:12 - [info] Flows file     : /home/pi/.node-red/flows_astroberry.json
(node:1400) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'
(node:1400) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1400) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
17 Dec 18:05:12 - [info] Server now running at http://127.0.0.1:1880/
17 Dec 18:05:13 - [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.
---------------------------------------------------------------------
17 Dec 18:05:13 - [info] Starting flows
17 Dec 18:05:13 - [info] Started flows

So unless my power supply has misleading labelling, I think there is something else at play here...

I'm not sure this will help.

node-red-stop
npm install

then try

node-red-start

See what happens.

It looks like something is not finding something it wants.

(node:1400) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'
(node:1400) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1400) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

So trying that may help. No promises. I'm not that smart sorry.

Done - should I be worried about these warnings?

astroberry@astroberry:~ $ npm install
npm WARN npm npm does not support Node.js v10.24.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN saveError ENOENT: no such file or directory, open '/home/astroberry/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/astroberry/package.json'
npm WARN astroberry No description
npm WARN astroberry No repository field.
npm WARN astroberry No README data
npm WARN astroberry No license field.

up to date in 0.532s

I don't think it will be helping.

But I shall defer to people of more knowledge.

Sorry.

Nothing to do with power supply.
Dashboard version 3 requires nodejs 12 or better. You can either go back to dashboard 2.x or upgrade nodejs.

Would it be possible to log an appropriate error on startup when this is not satisfied, to make it easier to diagnose the problem?

Well the package.json does have an engines statement that should cause the install to flag it - but yes I guess we could dig it out each time.

The startup message doesn't really convey what the problem is.
UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/examples'

So if it were easy to show something more helpful it might be worth it. On the other hand it will affect only systems running old versions of node-red, so perhaps it isn't worth worrying about.

Just for completeness, you should have run that from the .node-red folder. Though you didn't need to run it in this instance anyway. If you do upgrade nodejs then after the upgrade you should run npm install in order to rebuild any nodes that depend on the nodejs version.

Chiming in with my $0.02 here...

While the number of users running these particular versions of NR dashboard and nodejs are likely to decrease, I would image that the issue of conflicting versions or missing dependencies will never go away. As an entry level user with very limited knowledge, having a clearer error message would be really helpful. It doesn't have to be very specific - something like "NR crashed because the dash is missing some sort of dependency" would help increase the overall user friendliness IMO.

This distinction is lost on me I'm sorry to say... Is this mission critical? What would you recommend I Google so I can better understand the implications?

As for the initial issue... I uninstalled a bluetoothLE node that was displaying an error/warning symbol in the palette manager and muddled my way through some updates/upgrades of nodejs and npm... I think... and now the issue seems to have gone away. I'll update this thread if it happens again. Thanks to every one for your help!

And BTW, why not also upgrade NR to the latest?

The npm install command looks for a package.json, and package-lock.json in the current folder, or possibly parent folder, and makes sure that all modules defined there are installed into the node_modules subfolder. You ran it from your home folder so it would not have found your package.json file, and would have installed into the node_modules subfolder of your home folder. When is run from the .node-red folder it makes sure that all the packages that you have manually installed are installed into .node-red/node_modules.
As to what you should do, delete the node_modules subfolder of your home folder (not the one under .node_red). Also if npm has created a package.json file and/or package-lock.json in your home folder then delete them. Again don't delete the one in your .node-red folder.

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