For auto-start, you should have a systemd service script. I think that Dave's installer script sets that up so you can look in that. You could also look in my alternate installer repo which has an example script file with some extended features.
By using systemd, node-red is started at bootup and restarted on fail. You can manually restart with a command too ( the example package.json file in my alt installer should have the commands listed I think).
And the max-old-space may not be needed with newer versions of node.js so you may wish to try without first.
Once Node-RED has started, point a browser at http://192.168.1.98: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
Starting as a systemd service.
<--- Last few GCs --->
[3067:0x5971f70] 68 ms: Mark-sweep 0.3 (2.8) -> 0.3 (2.8) MB, 1.3 / 0.0 ms (average mu = 0.254, current mu = 0.026) allocation failure GC in old space requested
[3067:0x5971f70] 70 ms: Mark-sweep (reduce) 0.3 (2.8) -> 0.3 (1.8) MB, 1.5 / 0.0 ms (average mu = 0.151, current mu = 0.023) last resort GC in old space requested
[3067:0x5971f70] 71 ms: Mark-sweep (reduce) 0.3 (1.8) -> 0.3 (1.8) MB, 1.2 / 0.0 ms (average mu = 0.097, current mu = 0.022) last resort GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
nodered.service: Main process exited, code=killed, status=6/ABRT
nodered.service: Failed with result 'signal'.
That is unusual. What does the command node -v
show?
Can you post the file /var/log/nodered-install.log please. If that file is empty then try /var/log/nodered-install.log.1
If the first one is not there then we need to know why, hence my request for the other information. Has the second one been added to the script recently? It is not present on my Pis.
Yes, Node-RED is installed on all of them using the officially provided install script. However, due to Node no longer supporting armv6 hardware, I have installed an unofficial build of Node v16.11.0 with my own script (I am unaware if this may have an effect on it) for the Pi 0 W's.
The script should cope with armv6 by downloading nodejs from an alternative source.
The service file comes from here I believe, and the space setting is adjusted based on the amount of memory available. Perhaps that calculation has gone wrong. @Jeff2 could you copy/paste the service file please so we can have a look at it?
@HaroldPetersInskipp, I don't know where your PI_NODE_OPTIONS entry has come from.
Note that if you re-run the script it will overwrite your changes to the service file. If you want to amend something in an installed service file it is better to use the systemd override feature to do that, then the mods will not get removed if you rerun the script. Look up systemctl edit for how to do that.
It came from me manually editing it in. I believe the install script warns the user and leaves the service file alone if it detects it has been edited.
Basically what I'm trying to say is that my installs on my Pi 0 W's may be unconventional, and should not be solely relied upon for debugging a installation issue.
I think there is an error in that page, if you look at the first and third boxes you will see that in the first it is called PI_NODE_OPTIONS and in the third the same line has NODE_OPTIONS. I suspect that the former may be from a very old version of the file. I am fairly confident that the only one that matters is NODE_OPTIONS.