Node Red crashed and I am not able to restart

I am running NodeRed on a Raspbery Pi Zero, and to day it has crashed while I was changing MQTT sub information. I would be really grateful if anyone has a solution.
I have stopped and re-started node red in safe mode, I have attached what i am seeing

sg@raspberrypi:~ $ node-red --safe
                const newCredentialKeys = Object.keys(newCreds?.map || [])

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js:24:19)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

I am unsure how to apply the backup file, if that is possible I am unsure.

Any help would be really appreciated. Thanks


What backup file is that?

You could try renaming your flows credentials file in case it is corrupt.

cd ~/.node-red
mv flows_cred.json flows_cred.json.broken

If that allows Node-red to start you will have to set up again any credential nodes such as MQTT brokers, email accounts etc.

If it's still broken, re-run the Node-red installation script.

Node-red should not crash because of misconfiguration of a core node. I suspect something else is amiss.

What version of node and node-red do you have installed?

From the command line, run

node -v
node-red --help