[SOLVED] Node-red To install as root or not as root? Error or Normal

  • Platform information:
    • Hardware: _CPUArchitecture/RAM/storage - RPI3
    • OS: _what OS is used and which version โ€“ Openhabian

Issue is: When I run openhabian-config and install optional components then node-red, I get the question below about being root.

Root user detected. Typically install as a normal user. No need for sudo.

Are you really sure you want to install as root ? (y/N) ? y


This script will remove versions of Node.js prior to version 6.x, and Node-RED and
if necessary replace them with Node.js 8.x LTS (carbon) and the latest Node-RED from Npm.

It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.

It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.

To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.

Are you really sure you want to do this ? [y/N] ?

My second question is: if I wanted to put in a feature request / bug report where would one put it for the openhabian-config. The second feature is that when you answer N to the question, it kept going anyway.

Hi @Thedannymullen I have just started to play with a fresh OpenHABian 1.4.1 install on an RPi 3B a few days ago, and I can confirm that the issue with the installation of Node-RED running as user root still exists, and so does the fact that npm is run after saying NO to running the script as root.

At this time I have decided to stop the installation from openhabian-config, and since the script is saved as

/tmp/update-nodejs-and-nodered.sh

I have run that script as user openhabian and I look forward to seeing the results of this tomorrow, as I am running it overnight.

There seems to be little to no mention about Node-RED installation on this forum, something I find quite interesting. Maybe people have used other ways to install Node-RED on their OpenHABian machines?

Bye, Luca

Thanks Luca! I wish I would have thought of doing this. Great catch! Will love to hear the status tomorrow. Maybe I will try using node red again.

I went ahead and just installed it the day after I posted this. It was on my test machine which I have reimaged a few times since then. The main reason I just did the install was because I wanted to do a test prior to reimaging the sd card.

Thanks for the response! I too have been shocked there is not much about node red in forums.

Hi @Thedannymullen,

Just to confirm how things went after my previous message, the installation I ran from the CLI with the normal unprivileged user โ€œopenhabianโ€ worked great, and I am now happily using Node-RED on my OpenHABian-based Raspi3.

The only change I had to make was to enable the system to launch Node-RED by default at startup, by doing:

sudo systemctl enable nodered

Yes, truly sad to see so few mentions of Node-RED on this forum. But there is plenty of information out there once the system is up and running!

Bye, Luca

1 Like

Thanks!!

1 Like

If npm warns about an update, youโ€™ll see a message like:

   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                                               โ”‚
   โ”‚       New minor version of npm available! 6.4.1 โ†’ 6.9.0       โ”‚
   โ”‚   Changelog: https://github.com/npm/cli/releases/tag/v6.9.0   โ”‚
   โ”‚               Run npm install -g npm to update!               โ”‚
   โ”‚                                                               โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

In this case you must run the โ€˜globalโ€™ npm update command as root:
$ sudo npm install -g npm

Otherwise npm wonโ€™t be able to update (user openhabian doesnโ€™t have write access to /usr/lib/node_modules).