Cannot start node-red after updating!

After updating node-red 3.01 to 3.02 and NodeJS V14 to V16 can't start node-red any more.

nodered.service: Failed with result 'exit-code'

Please help with troubleshooting.

pi@raspberrypi:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at
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

Starting as a systemd service.
14 Dec 15:17:48 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Dec 15:17:48 - [info] Context store  : 'default' [module=memory]
14 Dec 15:17:48 - [info] User directory : /home/pi/.node-red
14 Dec 15:17:48 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Dec 15:17:48 - [info] Flows file     : /home/pi/.node-red/flows.json
14 Dec 15:17:49 - [info] Server now running at
14 Dec 15:17:49 - [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.
14 Dec 15:17:49 - [info] Starting flows
CREDS { secretConfig: '{}' }
14 Dec 15:17:49 - [info] [tuya-smart-device:AistesLED] Recieved the config {"id":"222db06ce97b147a","type":"tuya-smart-device","z":"d1b24b1396f6f4eb","deviceName":"AistesLED","disableAutoStart":false,"deviceId":"","deviceKey":"goem4r2by917fj1a","storeAsCreds":false,"deviceIp":"","retryTimeout":1000,"findTimeout":10000,"tuyaVersion":"3.1","eventMode":"event-both","x":390,"y":880,"wires":[["dc4a6827eed0da01"],[]],"credentials":{"secretConfig":"{}"},"moduleVersion":"5.0.0"}
14 Dec 15:17:49 - [info] [tuya-smart-device:AistesLED] Event subscription : shouldSubscribeData=>true , shouldSubscribeRefreshData=>true
14 Dec 15:17:49 - [info] [tuya-smart-device:AistesLED] Auto start probe on connect...
14 Dec 15:17:49 - [info] [tuya-smart-device:AistesLED] closeComm(): Cleaning up the state
14 Dec 15:17:49 - [info] [tuya-smart-device:AistesLED] closeComm(): Clearing the find timeout handler
14 Dec 15:17:49 - [info] [tuya-smart-device:AistesLED] closeComm(): Disconnecting from Tuya Device
14 Dec 15:17:49 - [info] Started flows
14 Dec 15:17:49 - [red] Uncaught Exception:
14 Dec 15:17:49 - [error] InvalidCountryCodeError: Invalid ISO 3166-1 Alpha-2 country code
    at HTTPApi.setCountry (/home/pi/.node-red/node_modules/eufy-security-client/build/http/api.js:85:19)
    at new EufySecurity (/home/pi/.node-red/node_modules/eufy-security-client/build/eufysecurity.js:107:18)
    at EufySecurityNode.initialise (/home/pi/.node-red/node_modules/node-red-contrib-eufy-security/eufy-security/01-eufy-security.js:81:21)
    at new EufySecurityNode (/home/pi/.node-red/node_modules/node-red-contrib-eufy-security/eufy-security/01-eufy-security.js:66:14)
    at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:90:27)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:206:48)
    at Object.start [as startFlows] (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:394:33)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 10.756s CPU time.
pi@raspberrypi:~ $

It would seem there is an error in this node you have loaded ???
maybe you can start node-red manually using node-red --safe so they flows don't run, and you can edit the flow to fix or remove that node then redeploy.

Welcome to the forum @`

How did you upgrade nodejs? If you did not use the Debian/Ubuntu/Pi upgrade script then after upgrading you should go into your .node-red folder and run
npm rebuild
If that doesn't fix it then make sure you are using the latest version of the node that is crashing node-red - node-red-contrib-eufy-security

Do you pass it a country code? If so then check that the one you are passing is valid. It may be, however, that the node is not compatible with nodejs 16.

I start node-red manually using node-red --safe as you advised and deleted node-red-contrib-eufy-security flow and now it is working fine.
Many thanks for your help.

I did use Pi upgrade script from Node-red website. Looks like "node-red-contrib-eufy-security" caused the problem. After removing it, node-red working fine.

1 Like

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