Node-red-start on raspberry pi not working

Hi to everybody.

I had to upgrade nodejs and npm to latest version to be able to use MCP4725 digital to analog converter library on my Raspbian RPi on Stretch.


And now, node red has disapeared from the menu.
But most important, at command line "node-red-start" is not found.

I can only start with the command "node-red" which could be fine but also the command "node-red-stop" isn't found !

And I don't know how to stop node-red ?

Any help too make things working as before with "node-red-start" and "node-red-stop" ?

How did you upgrade ? did you use our upgrade script ?
Which versions of node and npm are you now on ?

If you just use node-red to start then ctrl-c will stop it :slight_smile:

node-red-start and-stop should be in the /usr/bin directory if they are still there… but obviously may now be pointed to the wrong place… there are also instructions in our docs to tell you how to e-install them manually -
https://nodered.org/docs/hardware/raspberrypi#adding-autostart-capability-using-systemd

I cant really tell how I upgraded as I tried so many things because I couldn’t get things working at first.
But I don’t think, I’ve used your script.
Version are :
v9.11.1 for nodejs.
5.6.0 for npm.
I’ll have a deeper look at your doc.

Thanks for your reply indeed.

I have the same problem and could not finde a solution. Maybe there is a lak of understanding in linux things?

Situation:
the command ./node-red works to start, but node-red-start fails with the folowing error. To be able to start the Node-RED independend while booting the Raspi, I need to get it working with node-red-start.

nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
nodered.service: Start request repeated too quickly.
Failed to start Node-RED graphical event wiring tool.
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.

Versions
[info] Node-RED version: v0.18.7
[info] Node.js version: v8.11.3
[info] Linux 4.9.41-v7+ arm LE

Hardware: RPi3

what I did
I installed Node-RED somehow some days ago and started playing arround. Becaus I didn't had a entry in a menue like in a tutorial, I desided to upgrade to the newest version of node-RED, what I hadn't. The Upgrade I did with the folowing line.

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

thanks a lot for your ideas and help!

so when you run that script line did everything finish with a tick?
(You can run it again and see...)

If you use the command node-red-log what does it return?

Script
This I forgot to mention. The folowing line finishes with a "+". In this part, I am not shure if this is correct. So I just tryed to input "nvm use lts/*" bevore starting with node-red-start.

Using NVM to manage Node.js + please run nvm use lts/* before running ./node-red

Full Script Output

This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Using NVM to manage Node.js         +   please run   nvm use lts/*   before running ./node-red
  Update Node.js LTS                  ✔   Node v8.11.3   Npm 6.3.0
  Clean npm cache                     ✔
  Install Node-RED core               ✔   0.18.7
  Move global nodes to local          -
  Install extra Pi nodes              -
  Npm rebuild existing nodes          ✔
  Add menu shortcut                   ✔
  Update systemd script               ✔
      id=Node-RED.desktop

Any errors will be logged to   /var/log/nodered-install.log


All done.
  You can now start Node-RED with the command  ./node-red
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started  Mon Aug 13 19:33:34 CEST 2018  -  Finished  Mon Aug 13 19:36:59 CEST 2018

node-red-log

nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
nodered.service: Start request repeated too quickly.
Failed to start Node-RED graphical event wiring tool.
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.

Use the node-red-log command to see why the service is stopping.

In my last post I added the ouput of the node-red-log, but was not able to finde the problem with it, becaus I don't know what 'exit-code' or "status=127/n/a" should mean.

My apologies, I was expected a bit more output from node-red itself... but this shows it isn't even starting the node process at all. Some there must be something fundamentally off here.

When you run node-red manually (by running the command node-red) - can you share the full log output?

I wonder if there's a permissions issue here with the node-red user directory it is trying to use.

I suspect it's nvm getting in the way... you may need to do the update to nodejs 8 from within nvm itself as that whole environment is a bit weird.

You mean the output direct in the console while starting the process with "node-red"? Here we go.

Sorry if I understand some things wront. I'm about learing all things with linux.

node-redpi@raspberrypi:~ $ node-red
14 Aug 07:54:11 - [info]

Welcome to Node-RED
===================

14 Aug 07:54:11 - [info] Node-RED version: v0.18.7
14 Aug 07:54:11 - [info] Node.js  version: v8.11.3
14 Aug 07:54:11 - [info] Linux 4.9.41-v7+ arm LE
14 Aug 07:54:13 - [info] Loading palette nodes
14 Aug 07:54:18 - [info] Dashboard version 2.9.6 started at /ui
14 Aug 07:54:20 - [info] Settings file  : /home/pi/.node-red/settings.js
14 Aug 07:54:20 - [info] User directory : /home/pi/.node-red
14 Aug 07:54:20 - [warn] Projects disabled : editorTheme.projects.enabled=false
14 Aug 07:54:20 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
14 Aug 07:54:20 - [info] Server now running at http://127.0.0.1:1880/
14 Aug 07:54:20 - [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 Aug 07:54:20 - [info] Starting flows
14 Aug 07:54:20 - [info] Started flows
14 Aug 07:54:20 - [info] [mqtt-broker:4de5a62e.392798] Connected to broker: mqtt://localhost:1883

oh maybe I found the problem... I was up to finde out how to update nvm. So I ended up with some thing like "nvm update npm" and got the folowing. By the way, would this be the correct way or do I just update npm with this and not nvm?

...

npm WARN tar ENOENT: no such file or directory, lstat '/tmp/npm-19670-a1a32579/unpack-a4ea40ba/node_modules/yargs'
npm WARN tar ENOENT: no such file or directory, lstat '/tmp/npm-19670-a1a32579/unpack-a4ea40ba/node_modules/yargs'
npm WARN tar ENOENT: no such file or directory, lstat '/tmp/npm-19670-a1a32579/unpack-a4ea40ba/node_modules/yargs'
npm WARN tar ENOENT: no such file or directory, lstat '/tmp/npm-19670-a1a32579/unpack-a4ea40ba/node_modules/yargs'
npm WARN tar ENOENT: no such file or directory, lstat '/tmp/npm-19670-a1a32579/unpack-a4ea40ba/node_modules/yargs'
npm WARN tar ENOENT: no such file or directory, lstat '/tmp/npm-19670-a1a32579/unpack-a4ea40ba/node_modules/yargs'
npm ERR! code ENOSPC
npm ERR! errno -28
npm ERR! syscall write
npm ERR! nospc ENOSPC: no space left on device, write
npm ERR! nospc There appears to be insufficient space on your system to finish.
npm ERR! nospc Clear up some disk space and try again.
* npm upgraded to: v6.3.0

After that I checked the disk space, what shows me the reason. It is full... I just had a 8GB SD Card for my RPi arround.

pi@raspberrypi:~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        5799504 5481860         0 100% /
devtmpfs          468148       0    468148   0% /dev
tmpfs             472756       0    472756   0% /dev/shm
tmpfs             472756   12276    460480   3% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             472756       0    472756   0% /sys/fs/cgroup
/dev/mmcblk0p6     69553   21473     48081  31% /boot
tmpfs              94548       0     94548   0% /run/user/1000
/dev/mmcblk0p5     30701     455     27953   2% /media/pi/SETTINGS

As a next step I will order a biger SD-Card and come back to you with my resoults in the next days. Thanks for your help!

Or (seeing as you are starting over) - try the Raspbian minimal install version image which does fit well under 8GB, and then install Node-RED directly (without nvm :slight_smile: - as per our docs. https://nodered.org/docs/hardware/raspberrypi

thanks a lot for that hint! I was able to fix all my problems with start again with raspian minimal.

what I did to solve the problems

  • Install Raspbian minimal on a 8GB SD Card for my RPi3
  • install MQTT Server Mosquitto by command line
  • install NodeRed from this description https://nodered.org/docs/hardware/raspberrypi
  • set nodered to startup with sudo systemctl enable nodered.service

Installation

This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       ✔
  Install Node.js LTS                 ✔   Node v8.11.3   Npm 5.6.0
  Clean npm cache                     ✔
  Install Node-RED core               ✔   0.19.0
  Move global nodes to local          -
  Install extra Pi nodes              -
  Npm rebuild existing nodes          ✔
  Add menu shortcut                   ✔
  Update systemd script               ✔
grep: /home/pi/.config/lxpanel/LXDE-pi/panels/panel: No such file or directory

Any errors will be logged to   /var/log/nodered-install.log


All done.
  You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started  Tue 14 Aug 10:03:17 UTC 2018  -  Finished  Tue 14 Aug 10:07:15 UTC 2018

Storage status

pi@raspberrypi:~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7579256 1204624   6034020  17% /
devtmpfs          470116       0    470116   0% /dev
tmpfs             474724       0    474724   0% /dev/shm
tmpfs             474724    6368    468356   2% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             474724       0    474724   0% /sys/fs/cgroup
/dev/mmcblk0p1     43539   22193     21347  51% /boot

oooo . look at you... on 0.19 already !!!

For what it's worth, I have rpi3B running stretch (Debian) with update and upgrade done. When I did the update to node.js 10.14.2 I encountered exactly the same problem. Every time I run node-red-start it tells me

Node-RED is not yet fully installed

and runs the loop.

Suggested fixes here so far have not helped me. I can run NR by using 1 of 2 commands in the CLI, either ./node-red or node-red. Behaviour is fine using either one however I have to leave the terminal window open and cannot now find any way to get NR to start automatically upon boot or restart.

(Oddity: Not sure why NR states "Node.js version: v6.15.1" when it starts, nvm tells me I am using 10.14.2, but an email node wont run cause it too complains I have to have node.js above v8.)

st

If you haven't tried

sudo rm -rf /usr/lib/node_modules
sudo rm -rf /usr/bin/node

give it a go and then re-run the install script again
Simon

If node red says it using v6.x in the startup log (which I presume is what you mean) then that is the version it is using. I haven't used nvm so don't know much about it.

On the installation problem, delete the file /var/log/nodered-install.log then run the bash <(curl script and post the install log file here.

Please don't suggest this without the corresponding caveat that this will be remove all npm modules that have been installed - including any installed unrelated to node-red.

When running as a service, it will not pickup any of your nvm environment configuration and will fall back to your system installed node version.

I wonder now why it says 'nodered' not installed?


Started : Sun Dec 23 10:41:43 EST 2018
Running for user pi at /home/pi
Found global nodes: :
Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodered' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
npm WARN deprecated mailparser@0.6.2: Mailparser versions older than v2.3.0 are deprecated
npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See Status :: Nodemailer
npm WARN deprecated mimelib@0.3.1: This project is unmaintained
npm WARN deprecated mailcomposer@2.1.0: This project is unmaintained
npm WARN deprecated buildmail@2.0.0: This project is unmaintained
/home/pi/.nvm/versions/node/v10.14.2/bin/node-red -> /home/pi/.nvm/versions/node/v10.14.2/lib/node_modules/node-red/red.js
/home/pi/.nvm/versions/node/v10.14.2/bin/node-red-pi -> /home/pi/.nvm/versions/node/v10.14.2/lib/node_modules/node-red/bin/node-red-pi

  • node-red@0.19.5
    updated 1 package in 37.238s
    0.19.5
    The user pi' is already a member of gpio'.
    Finished : Sun Dec 23 10:41:43 EST 2018