Non-starting Node-RED on my RPI

I havent got the "Manage Palette" option, just recently went from 1.x to 3.

Read something about that it had to do with old npm so I followed some commands...
Now I am stuck with at non starting Node-RED installation on my Pi.

This is from my log

pi@RaspGreen:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://10.16.0.31: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.
Started Node-RED graphical event wiring tool.
node-pre-gyp info This Node instance does not support builds for Node-API version 3
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/empty/index.js:13
  } catch {
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.

Where could I go from here?

Hi @cybix and welcome to community, What was way you updated 1.x to 3? Try with this command from Node-RED official page:

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

This script will:

  • remove the existing version of Node-RED if present.
  • if it detects Node.js is already installed, it will ensure it is at least v14. If less than v14 it will stop and let the user decide whether to stay with Node-RED version 1 - or upgrade Nodejs to a more recent LTS version. If nothing is found it will install the Node.js 16 LTS release using the NodeSource package.
  • install the latest version of Node-RED using npm.
  • optionally install a collection of useful Pi-specific nodes.
  • setup Node-RED to run as a service and provide a set of commands to work with the service.

This suggests NPM is not installed.

What do you get if you run npm -v and node -v

did you use the official script?

Additionally, did you include the CLI option to upgrade Node.js to v16 or greater?

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node16

1 Like

Thanks for the welcome!
Have to admit that I cant remember how I did the upgrade, it was a month ago and everything seemed fine, just recently noticed the palette missing.

I now have runned the script and it ended with a "you are on node v8, if you still want to run that, downgrade your node-red to 1 or 2". So probably didnt do the upgrade complete/correct.

Here are my versions:

pi@RaspGreen:~ $ npm -v
1.4.21
(node:17862) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
pi@RaspGreen:~ $ node -v
v8.11.1

So I have npm, it seems, I think I have installed it while trying to fix things yesterday, but the node seems outdated.

I have started the script again, now with the addition of --node16, its currently running.

Thanks to both of you with so swift and helpful comments!

Hmm, seems that I have another problem as well. The script ran fine until installation of npm (I think) then I got this error:

sudo: /usr/bin/sudo måste ägas av uid 0 och ha setuid-biten inställd

I think you understand although its in swedish. I checked the ownership and it is indeed pi who owns it (and all other files in /usr/bin but that might be right?).

While reading up on it I read that this might be a solution:
chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
It also said I were to log in as root instead of pi and now it seems I dont know my root password....

This is turning into a mess. Maybe I should just reinstall the raspberry from start?
If so, can I just keep my flows-file and put it in place in a fresh install?

This raspberry are only for measuring wheather, I do have another "main" node-red installation done with docker. But does'nt it seems to be overkill to run docker on the raspberry?

Almost certainly there is no need for that. You have a very old version of nodejs. To tell the install script to install a recommended version use the command
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node16

First it is a good idea to run
sudo apt update && sudo apt full-upgrade
to make sure all the system packages are up to date.

If the node red script doesn't work then post the install log here (/var/log/nodered-install.log)

You should have your flows file and other data backed up in case of disaster. You should back the complete ~/.node-red folder, except for the node_modules folder, which can be easily recreated if necessary.

I am kinda stuck, but its not a nodered problem anymore.
I can't use 'sudo'

Have tried to switch to root but its probably not active (or I have forgotten passwd), but all demands sudo to work. Read about someone who took the sd-card out, mounted it on another computer and chown:ed /usr/bin and got it to work that way. I might reinstall after all.

Why not?

What happens when you run the script to install node red?

Half way through the script (I have node 16.20.1 now, this installed before the error) I get the error with:

"sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid-bit set"

The rest of the script fails with that error (like 20 times).

If I just run 'sudo' now, I get this error. If I look at the rights for /usr/bin its owned by 'pi', but I cant change that because I cant run sudo.

So your system is messed up. Maybe it would be best to reinstall the os. Don't forget to backup the .node-red folder.

How did you manage to update nodejs without using sudo?

1 Like

I ran the script just as you wrote, without sudo. Seemed to work fine in the first half, and node did install fine. But, as I said in the middle of the script the error kept coming.

You put it well, the os is messed up, I will reinstall OS, and I close this thread. Thanks for the help!

1 Like

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