I have a Raspberry-Pi that hosts some HTML and uses GPIO to open and close my garage door. It also sends an sms (twilio) message when the door opens and when the door closes.
On Dec 10 the SMS portion stopped working. I have been chasing possible problems and fixes for 12 days and now find myself with no html ui either.
I had proper html access to the UI until I ran this to try and get the SMS working: node-red-contrib-sms-twilio
After running, I rebooted the pi, and now I have lost the UI.
I can't get to my Garage Door ui or to the Node-Red ui at :1880
I'm so far into this black hole, I feel like I have never written a line of code in my life. Totally stuck and sad...
I could use some pointers on how to get this going again.
Hoping for a happy holiday.....
Thanks.
Start node red in safe mode: node-red --safe (in terminal)
If this happened after you installed node-red-contrib-sms-twilio
Whilst in safe mode - you can uninstall it (after removing any of its nodes/configs you added to your flow)
This Node hasn't been updated in 8+ years... sounds to me, this might have caused the issue.
Safe Mode, stops all flows from running, and by extension, Nodes that are breaking things.
You can also uninstall it by going to ~/.node-red and running: npm uninstall node-red-contrib-sms-twilio (in terminal)
then trying to start Node red again
EDIT
Oh... reading again, you have always used it?
Strange how the SMS part has stopped - and now your Node RED isn't working
Using Safe Mode, you will be able to (hopefully) pinpoint whats going on
pi@garagedoor:/home $ node-red --safe
/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:797
if (sendEvent?.destination?.node) {
^
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/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:19:12)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
pi@garagedoor:/home $
Node RED's UI uses express - its not a fully fledged web server, and its not "installed"
Node RED its self is hosting the "web server" via express.
As for the error.
Its complaining that the optional chaining operator is not recognised.
optional chaining was added in node version 14 (I think) - so it would appear you are using an old version of Node? -do you use a Node version manager like nvm?
This may be helpful.....
Looks like nodered.service is stuck on activating.
UNIT LOAD ACTIVE >
alsa-restore.service loaded active >
avahi-daemon.service loaded active >
console-setup.service loaded active >
cron.service loaded active >
dbus.service loaded active >
dhcpcd.service loaded active >
dphys-swapfile.service loaded active >
fake-hwclock.service loaded active >
getty@tty1.service loaded active >
ifupdown-pre.service loaded active >
keyboard-setup.service loaded active >
kmod-static-nodes.service loaded active >
networking.service loaded active >
nodered.service loaded activating>
polkit.service loaded active >
raspi-config.service loaded active >
rc-local.service loaded active >
rng-tools-debian.service loaded active >
rpi-eeprom-update.service loaded active >
rsyslog.service loaded active >
serial-getty@ttyAMA0.service loaded active >
ssh.service loaded active
My current advise will be to update to at least Node 20, and reboot.
I wouldn't use Node Version managers (if of course you are) - they can be problematic.
You may need to re-install your Node Modules, but isn't that big of a step - its pretty easy to do via command line - it uses your package file, in ~/.node-red as some modules are compiled against the Node Version
Run which node and see if it is picking up nodejs from a .nvm folder. If it is then delete that folder and uninstall nvm. Then re-run the install script (see below) to install nodejs 20
Otherwise, did you use the recommended script to install/update node-red? If not, then run that script, with --node20 on the end to update node red and install nodejs 20.
I think the installer running now is putting it in a .nvm folder
pi@garagedoor:~ $ nvm install 20
Downloading and installing node v20.18.1...
Downloading https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-armv6l.tar.xz.. .
curl: (22) The requested URL returned error: 404
download from https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-armv6l.tar.xz failed
grep: /home/pi/.nvm/.cache/bin/node-v20.18.1-linux-armv6l/node-v20.18.1-linux-ar mv6l.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 1 CPU core(s)
Number of CPU core(s) less than or equal to 2, running in single-threaded mode
Additional options while compiling: --without-snapshot
Downloading https://nodejs.org/dist/v20.18.1/node-v20.18.1.tar.xz...
######################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
You were supposed to be uninstalling nvm and deleting the .nvm folder if it existed.
So it was (before you used nvm) running nodejs from the correct place. My suggestion was to run the node red install script, but instead you ran nvm. I think you are not reading the posts carefully enough.