Can't run node-red

Hi everyone.
I'm starting with Node-RED on a RPi 3 running Raspbian Scratch, and I just can't start Node-red.
I tried with node-red-start command and with sudo systemctl start nodered.service
Both ways return something like this:

nodered.service - Node-RED graphical event wiring tool
Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-08-02 20:50:41 -03; 6s ago
Docs: Redirecting…
Process: 9869 ExecStart=/usr/bin/env node-red-pi $PI_NODE_OPTIONS $NODE_RED_OPTIONS (code=exited, status=217/USER)
Main PID: 9869 (code=exited, status=217/USER)

ago 02 20:50:41 RaspberryPi systemd[1]: nodered.service: Failed with result 'exit-code'.
ago 02 20:50:41 RaspberryPi systemd[1]: nodered.service: Service hold-off time over, scheduling restart.
ago 02 20:50:41 RaspberryPi systemd[1]: Stopped Node-RED graphical event wiring tool.
ago 02 20:50:41 RaspberryPi systemd[1]: nodered.service: Start request repeated too quickly.
ago 02 20:50:41 RaspberryPi systemd[1]: Failed to start Node-RED graphical event wiring tool.
ago 02 20:50:41 RaspberryPi systemd[1]: nodered.service: Unit entered failed state.
ago 02 20:50:41 RaspberryPi systemd[1]: nodered.service: Failed with result 'exit-code'.

Someone could give a clue about what is happening.

Thanks a lot
Pinhal

How have you installed node-red?
What username are you using to run the command?

The command
node-red-log
should give more detail, but first, as @ukmoose asked, it is important to know how you installed node-red and whether you installed/updated it using the bash <(curl script in the installation docs [1]. If you haven't run that script then do so first. Also read through those docs as it will give other useful pointers to running on a pi.

[1] https://nodered.org/docs/hardware/raspberrypi

Well, I did not installed node-red itself, it supposed to be installed on raspbian distribution.
@ukmoose I'm using the same username I use to log on a Pi, I don't know how to use another one.

As @Colin said - Run the script. The version preinstalled with raspbian is a bit behind.
https://nodered.org/docs/hardware/raspberrypi

I tried to run the bash script as @Colin said but apparently it couldn't install the node.js package

Running Node-RED install for user pinhal at /home/pinhal

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

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js :heavy_check_mark:
Install Node.js LTS ✘ Failed to install Node.js - Exit
Clean npm cache
Install Node-RED core
Move global nodes to local
Install extra Pi nodes
Npm rebuild existing nodes
Add menu shortcut
Update systemd script

The latest raspbian image no longer includes node-red by default. Run the update script you've been pointed at and you'll get it.

Nope, it just dont wanna install node.js on my Pi
It retuns the same error.
I tried to install manually but get the same results.

The output normally points you at a log file to get more detailed information about the failure. I don't recall the exact path, but can you check it?

This is the last information on the log file:

nstalling the NodeSource Node.js 8.x LTS Carbon repo...


## Populating apt-get cache...

+ apt-get update
Obter:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease [17,5 kB]
Atingido:2 http://repo.mosquitto.org/debian stretch InRelease
Atingido:3 http://archive.raspbian.org/raspbian stretch InRelease
Atingido:4 http://archive.raspberrypi.org/debian stretch InRelease
Ign:5 http://repo.mosquitto.org/debian wheezy InRelease
Err:6 http://repo.mosquitto.org/debian wheezy Release
  404  Not Found [IP: 85.119.83.194 80]
Ign:7 https://dl.bintray.com/openhab/apt-repo2 stable InRelease
Obter:8 https://dl.bintray.com/openhab/apt-repo2 stable Release [6.051 B]
Atingido:8 https://dl.bintray.com/openhab/apt-repo2 stable Release
Ign:1 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Lendo listas de pacotes...
E: The repository 'http://repo.mosquitto.org/debian wheezy Release' does no longer have a Release file.
W: Erro GPG: http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease: As assinaturas a seguir não puderam ser verificadas devido à chave pública não estar disponível: NO_PUBKEY C2518248EEA14886
W: The repository 'http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease' is not signed.
Error executing command, exiting
Lendo listas de pacotes...
Construindo árvore de dependências...
Lendo informação de estado...
The following additional packages will be installed:
  libc-ares2 libhttp-parser2.8 nodejs-doc
Os NOVOS pacotes a seguir serão instalados:
  libc-ares2 libhttp-parser2.8 nodejs nodejs-doc
0 pacotes atualizados, 4 pacotes novos instalados, 0 a serem removidos e 70 não atualizados.
É preciso baixar 0 B/5.001 kB de arquivos.
Depois desta operação, 22,0 MB adicionais de espaço em disco serão usados.
A seleccionar pacote anteriormente não seleccionado libc-ares2:armhf.
(Lendo banco de dados ... 
(Lendo banco de dados ... 5%
(Lendo banco de dados ... 10%
(Lendo banco de dados ... 15%
(Lendo banco de dados ... 20%
(Lendo banco de dados ... 25%
(Lendo banco de dados ... 30%
(Lendo banco de dados ... 35%
(Lendo banco de dados ... 40%
(Lendo banco de dados ... 45%
(Lendo banco de dados ... 50%
(Lendo banco de dados ... 55%
(Lendo banco de dados ... 60%
(Lendo banco de dados ... 65%
(Lendo banco de dados ... 70%
(Lendo banco de dados ... 75%
(Lendo banco de dados ... 80%
(Lendo banco de dados ... 85%
(Lendo banco de dados ... 90%
(Lendo banco de dados ... 95%
(Lendo banco de dados ... 100%
(Lendo banco de dados ... 119505 ficheiros e directórios actualmente instalados.)
A preparar para desempacotar .../libc-ares2_1.14.0-1~bpo9+1_armhf.deb ...
A descompactar libc-ares2:armhf (1.14.0-1~bpo9+1) ...
A seleccionar pacote anteriormente não seleccionado libhttp-parser2.8:armhf.
A preparar para desempacotar .../libhttp-parser2.8_2.8.1-1~bpo9+1_armhf.deb ...
A descompactar libhttp-parser2.8:armhf (2.8.1-1~bpo9+1) ...
A seleccionar pacote anteriormente não seleccionado nodejs.
A preparar para desempacotar .../nodejs_8.11.1~dfsg-2~bpo9+1_armhf.deb ...
A descompactar nodejs (8.11.1~dfsg-2~bpo9+1) ...
A seleccionar pacote anteriormente não seleccionado nodejs-doc.
A preparar para desempacotar .../nodejs-doc_8.11.1~dfsg-2~bpo9+1_all.deb ...
A descompactar nodejs-doc (8.11.1~dfsg-2~bpo9+1) ...
Configurando nodejs-doc (8.11.1~dfsg-2~bpo9+1) ...
A processar 'triggers' para libc-bin (2.24-11+deb9u3) ...
A processar 'triggers' para man-db (2.7.6.1-2) ...
Configurando libc-ares2:armhf (1.14.0-1~bpo9+1) ...
Configurando libhttp-parser2.8:armhf (2.8.1-1~bpo9+1) ...
Configurando nodejs (8.11.1~dfsg-2~bpo9+1) ...
update-alternatives: a usar /usr/bin/nodejs para disponibilizar /usr/bin/js (js) em modo auto
A processar 'triggers' para libc-bin (2.24-11+deb9u3) ...

Sorry about some informations in Portuguese :blush:

Go into the /etc/apt/sources.list.d directory and remove the nodesources.list file. Then (as pi user) rerun the install script

There isn't this file in the sources.list.d directory

That doesn't look like a node-red problem. Why are you referencing the wheezy repository for mosquitto? I would have expected it to be from the stretch repo.

Hmmm. If that dir is not there then it’s odd that the script is not “doing the right thing”. What does. node -v. report. And also npm -v. ?

@dceejay the mosquitto and Java entries won't be in the nodesources file will they?

No, it only points to the nodejs repository.

That's what I thought.
@Uspinhal try running, in a terminal
sudo apt-get update
I expect that to fail due to some problems with your apt sources list. You need to sort those first before you will be able to install or update anything at all.

Sorry about return.
I try to install all over again since Raspbian and finally I got all running.
Thanks a lot for all the help.

hello ,

I've installed the node-red on Debian Jessie successfully and everything works fine .until I was trying to create startup file and enable the auto start that I realized the node-red is not opening and stuck in login page and keep running...
it sounds to me the "Node-RED graphical event wiring tool" and this is the log file .please help me if you know to fix it :frowning:

root@ts-imx6ul:~# node-red-log

Stopping Node-RED graphical event wiring tool...
Starting Node-RED graphical event wiring tool...
Started Node-RED graphical event wiring tool.
nodered.service: main process exited, code=exited, status=217/USER
Unit nodered.service entered failed state.
nodered.service holdoff time over, scheduling restart.
Stopping Node-RED graphical event wiring tool...
Starting Node-RED graphical event wiring tool...
Started Node-RED graphical event wiring tool.
Failed at step USER spawning /usr/bin/env: No such process
nodered.service: main process exited, code=exited, status=217/USER
Unit nodered.service entered failed state.
nodered.service holdoff time over, scheduling restart.
Stopping Node-RED graphical event wiring tool...
Starting Node-RED graphical event wiring tool...
Started Node-RED graphical event wiring tool.
Failed at step USER spawning /usr/bin/env: No such process
nodered.service: main process exited, code=exited, status=217/USER
Unit nodered.service entered failed state.
nodered.service holdoff time over, scheduling restart.
Stopping Node-RED graphical event wiring tool...
Starting Node-RED graphical event wiring tool...
nodered.service start request repeated too quickly, refusing to start.
Failed to start Node-RED graphical event wiring tool.
Unit nodered.service entered failed state.
^Croot@ts-imx6ul:~# node-red-stop

How are you trying to make Node-RED autostart?
I’m pretty sure that the systemd scripts assume you are running as user pi, as there is very little justification to run as root.

This error is a systemd error rather than Node-RED caused by this