Unable to start Node-red upon boot

I don't think that is the whole log.

By the way, see this for installing plexmediaserver, you have an out of date repository specified. Go down a bit to where it shows how to enable the official repository.

I have looked at the install script and can't see how it didn't setup the script correctly, so would be grateful if you could post the full install log when convenient.
Thanks.

Log file....
nodered-install.log.txt (3.6 KB)

My Plex server is up to date. But I will take a look at the link you posted.
image

Thank you for your help.

That cannot be the whole of the log, it has not even got as far as installing nodejs.

Use one of methods to run the task at start up. i tried rc.local. you can execute it manually and verify. initial faced same issues.

sudo nano /lib/systemd/system/nodered.service
Replace
Environment="NODE_OPTIONS=--max_old_space_size=256"
with

Environment="NODE_OPTIONS=--max-old-space-size=256"

Worked for me.

hmmm I've just tried to upgrade node-red using the original script I used to install and now starting from the service fails, but I can get it to run if I run node-red-start.

I used the script

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

root@raspbx:~# sudo systemctl status nodered
ā— 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 Sun 2020-05-31 23:59:18 BST; 6min ago
     Docs: http://nodered.org/docs/hardware/raspberrypi.html
 Main PID: 435 (code=exited, status=127)

May 31 23:59:17 raspbx systemd[1]: nodered.service: Failed with result 'exit-code'.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Service hold-off time over, scheduling restart.
May 31 23:59:18 raspbx systemd[1]: Stopped Node-RED graphical event wiring tool.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Start request repeated too quickly.
May 31 23:59:18 raspbx systemd[1]: Failed to start Node-RED graphical event wiring tool.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Unit entered failed state.
May 31 23:59:18 raspbx systemd[1]: nodered.service: Failed with result 'exit-code'.

/usr/bin/env: ā€˜node-red-piā€™: No such file or directory

Also this " node-red-start - this starts the Node-RED service and displays its log output. Pressing Ctrl-C or closing the window does not stop the service; it keeps running in the background"

simply isn't true - pressing ctrl-c or closing the Window DOES stop the service on my install. I wish I hadn't tried to upgrade, the script has totally broken a working installation!

Can you show us the log from when you run the script ? And also a log of when you just run the node-red command

--------> Error log. <-------

node-red-log:

Started Node-RED graphical event wiring tool.

Node-RED is not yet fully installed
   Can't reach upgrade server - please check your internet connection.

whereas node-red-start starts the app within that terminal window, as soon as I close it or ctrl-c it stops again.

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

1 Jun 07:46:13 - [info] Node-RED version: v1.0.6
1 Jun 07:46:13 - [info] Node.js  version: v12.15.0
1 Jun 07:46:13 - [info] Linux 4.19.57-v7+ arm LE
1 Jun 07:46:14 - [info] Loading palette nodes
1 Jun 07:46:16 - [warn] ------------------------------------------------------
1 Jun 07:46:16 - [warn] [node-red-node-serialport/serialport] Error: The module '/root/.node-red/node_modules/@serialport/bindings/build/Release/bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
1 Jun 07:46:16 - [warn] ------------------------------------------------------
1 Jun 07:46:16 - [info] Settings file  : /root/.node-red/settings.js
1 Jun 07:46:16 - [info] Context store  : 'default' [module=memory]
1 Jun 07:46:16 - [info] User directory : /root/.node-red
1 Jun 07:46:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
1 Jun 07:46:16 - [info] Flows file     : /root/.node-red/flows_raspbx.json
1 Jun 07:46:16 - [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.
---------------------------------------------------------------------

1 Jun 07:46:16 - [info] Starting flows
1 Jun 07:46:17 - [info] Started flows
1 Jun 07:46:17 - [info] Server now running at http://127.0.0.1:1880/
1 Jun 07:46:17 - [info] [mqtt-broker:34ac2466.a0f64c] Connected to broker: node-red@mqtt://192.168.0.110:1883

--------> Error log. <-------

Why are you installing and running node-red in the root account?

I guess mainly because I'm installing it on RasPBX. It was working fine for 2+ (also installed under root) before I tried to upgrade.

Paste the install log /var/log/nodered-install.log here, something must have gone wrong there. If it had succeeded then it would not be running as root (assuming you were logged in as a normal user when you ran it, and did not use sudo).
If you have run the script multiple times then edit the file first so that just the last install is in the log.

----->Here's my most recent attempt. <-----

Remember - it installs fine but will only allow itself to be run if called directly, won't work if called as a service.

node-red-log says:

Started Node-RED graphical event wiring tool.

Node-RED is not yet fully installed
   Can't reach upgrade server - please check your internet connection.

The internet connection is fine, I'm ssh into the Pi now from a remote location.

Also the thing about it not being fully installed can't really be true because it runs fine - from a local command.

cab you run which node-red and report the result please ?

dasdsa

so the log from your most recent attempt show you installing it as user nodered... and then the which node-red shows up as root. but when you run it's looking for node-red-pi - which we only call if you're not privileged user. So somewhat confused... as you installed as root can you try sudo node-red-start ?

Also look like the serialport isn't happy - can you go into the /root/.node-red dir (as root) and run npm rebuild

Thanks dceeja, feels like we're getting somewhere. It seems like whether it's installed as root or my nodered user, the installation just isn't finishing. Seems like it's a path problem? Like it's confused about where to find the binaries it needs?

Humour me... what do which node and sudo which node report ?

which node

EDIT: Seems similar to these issues and especially this one

yes - but you aren't using nvm...
ok - digging in.
Can you edit the /lib/systemd/system/nodered.service file and check what the user and group line (about 11 and 12) are set to... - As you are running as root they should be root and root. Then try manually - sudo systemctl start nodered and then sudo journalctl -f -n 0 -u nodered -o cat to see the log...