Trouble starting node red on Raspberry pi

Hi there,

a few days ago the Node Red install on my pi became unreachable...

I tried connecting like I have in the past by using a browser window with the address of xxx.xxx.x.9:1880 but it would not connect.

Logged into the pi using ssh and did an update for the pi and node-red and all seemed to install as expected....except when I ran node-red-start in a terminal window it returned the following without node red starting.....

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.9:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
27 May 12:15:54 - [info]
Welcome to Node-RED
===================
27 May 12:15:54 - [info] Node-RED version: v1.0.6
27 May 12:15:54 - [info] Node.js  version: v12.17.0
27 May 12:15:54 - [info] Linux 4.19.97-v7+ arm LE
27 May 12:15:55 - [info] Loading palette nodes
27 May 12:16:01 - [info] Dashboard version 2.17.1 started at /ui
27 May 12:16:02 - [info] Settings file  : /home/pi/.node-red/settings.js
27 May 12:16:02 - [info] Context store  : 'default' [module=memory]
27 May 12:16:02 - [info] User directory : /home/pi/.node-red
27 May 12:16:02 - [warn] Projects disabled : editorTheme.projects.enabled=false
27 May 12:16:02 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
27 May 12:16:02 - [info] Server now running at http://127.0.0.1:1880/
27 May 12:16:02 - [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.
---------------------------------------------------------------------
27 May 12:16:02 - [info] Starting flows
27 May 12:16:03 - [info] Started flows
27 May 12:16:03 - [info] [udp in:Shield] udp listener at 0.0.0.0:47998
(node:11520) UnhandledPromiseRejectionWarning: Error: Huejay: read ECONNRESET
    at /home/pi/.node-red/node_modules/huejay/lib/Transport.js:106:15
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:11520) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:11520) [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.
No Hue Bridge updates available. Checking again in an hour…
27 May 12:16:03 - [red] Uncaught Exception:
27 May 12:16:03 - Api Error: Unexpected response status; 404
    at requireStatusCode200 (/home/pi/.node-red/node_modules/node-red-contrib-hue/node_modules/node-hue-api/hue-api/httpPromise.js:100:15)
    at _fulfilled (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:787:54)
    at /home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:816:30
    at Promise.promise.promiseDispatch (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:749:13)
    at /home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:557:44
    at flush (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:108:17)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=100ms 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.
27 May 12:16:05 - [info]
Welcome to Node-RED
===================
27 May 12:16:05 - [info] Node-RED version: v1.0.6
27 May 12:16:05 - [info] Node.js  version: v12.17.0
27 May 12:16:05 - [info] Linux 4.19.97-v7+ arm LE
27 May 12:16:06 - [info] Loading palette nodes
27 May 12:16:13 - [info] Dashboard version 2.17.1 started at /ui
27 May 12:16:14 - [info] Settings file  : /home/pi/.node-red/settings.js
27 May 12:16:14 - [info] Context store  : 'default' [module=memory]
27 May 12:16:14 - [info] User directory : /home/pi/.node-red
27 May 12:16:14 - [warn] Projects disabled : editorTheme.projects.enabled=false
27 May 12:16:14 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
27 May 12:16:14 - [info] Server now running at http://127.0.0.1:1880/
27 May 12:16:14 - [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.
---------------------------------------------------------------------
27 May 12:16:14 - [info] Starting flows
27 May 12:16:14 - [info] Started flows
27 May 12:16:14 - [info] [udp in:Shield] udp listener at 0.0.0.0:47998
(node:11572) UnhandledPromiseRejectionWarning: Error: Huejay: read ECONNRESET
    at /home/pi/.node-red/node_modules/huejay/lib/Transport.js:106:15
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:11572) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:11572) [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.
No Hue Bridge updates available. Checking again in an hour…
27 May 12:16:15 - [red] Uncaught Exception:
27 May 12:16:15 - Api Error: Unexpected response status; 404
    at requireStatusCode200 (/home/pi/.node-red/node_modules/node-red-contrib-hue/node_modules/node-hue-api/hue-api/httpPromise.js:100:15)
    at _fulfilled (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:787:54)
    at /home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:816:30
    at Promise.promise.promiseDispatch (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:749:13)
    at /home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:557:44
    at flush (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:108:17)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=100ms expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 2.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
27 May 12:16:17 - [info]
Welcome to Node-RED
===================
27 May 12:16:17 - [info] Node-RED version: v1.0.6
27 May 12:16:17 - [info] Node.js  version: v12.17.0
27 May 12:16:17 - [info] Linux 4.19.97-v7+ arm LE
27 May 12:16:18 - [info] Loading palette nodes

I've searched for hours trying to find what has gone wrong but alas I've had no luck.

I'm not all that experienced with pi and node red and would appreciate and help.

did you make any changes to your flow before this happened?

it looks like a problem with the HUE - notice the Api Error: Unexpected response status; 404 which is causing node-red to crash and then it is restarted.

Do this, from a terminal window enter
sudo systemctl disable nodered.service
then
node-red-stop
then you should be able to start node-red in debug node with
node-red --safe
this will start the node-red dashboard. go to the Palette manager and get a list of all nodes you are currently using and see what hue nodes you are using. You should go to the GitHub page for thise nodes and see if there are any issue that may relate to your issue and maybe a solution.

If you want to get the flow working, disable any hue related nodes until you get a fix for the underlining issue

1 Like

And if you get the problem resolved as described by @zenofmud, don't forget to re-enable node-red.service:

sudo systemctl enable nodered.service

Otherwise it won't start after a reboot.

1 Like

thanks zenofmud

I had not changed anything as it was running fine.

Did as you suggested but NR refuses to start from a browser running on my pc. Looks like something more sinister is happening.

Here is readout from my ssh session...

pi@raspberrypi:~ $ node-red --safe
28 May 06:41:57 - [info]

Welcome to Node-RED

28 May 06:41:57 - [info] Node-RED version: v1.0.6
28 May 06:41:57 - [info] Node.js version: v12.17.0
28 May 06:41:57 - [info] Linux 4.19.97-v7+ arm LE
28 May 06:41:58 - [info] Loading palette nodes
28 May 06:42:05 - [info] Dashboard version 2.17.1 started at /ui
28 May 06:42:06 - [info] Settings file : /home/pi/.node-red/settings.js
28 May 06:42:06 - [info] Context store : 'default' [module=memory]
28 May 06:42:06 - [info] User directory : /home/pi/.node-red
28 May 06:42:06 - [warn] Projects disabled : editorTheme.projects.enabled=false
28 May 06:42:06 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
28 May 06:42:06 - [info] Server now running at http://127.0.0.1:1880/
28 May 06:42:06 - [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.

28 May 06:42:06 - [info] *****************************************************************
28 May 06:42:06 - [info] Flows stopped in safe mode. Deploy to start.
28 May 06:42:06 - [info] *****************************************************************
28 May 06:42:07 - [red] Uncaught Exception:
28 May 06:42:07 - Api Error: Unexpected response status; 404
at requireStatusCode200 (/home/pi/.node-red/node_modules/node-red-contrib-hue/node_modules/node-hue-api/hue-api/httpPromise.js:100:15)
at _fulfilled (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:787:54)
at /home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:816:30
at Promise.promise.promiseDispatch (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:749:13)
at /home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:557:44
at flush (/home/pi/.node-red/node_modules/request-util/node_modules/q/q.js:108:17)
at processTicksAndRejections (internal/process/task_queues.js:79:11)

Uninstall node-red-contrib-hue

node-red-stop
cd .node-red
npm remove node-red-contrib-hue
node-red-start --safe

remove the nodes from your flow, deploy.

3 Likes

thanks bakman2

That worked....don't have time to remove nodes as heading off to work (Oz time). Will do this in abt 10 hours and report back!!

Seems to be working ok.

Thanks to everyone for their assistance!

1 Like

For hue, I would recommend hue-magic instead,

2 Likes

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