I am new to RaspberryPi, and I am sure this is something simple about what the directory I am running out of but...
I can start using
node-red-pi --max-old-space-size=256
but when I run
node-red-start
I get
Starting as a systemd service.
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Object.join (path.js:1039:7)
at Object.<anonymous> (/usr/lib/node_modules/node-red/red.js:115:50)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=100ms expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 1.
Welcome to the forum.
How did you install node red? If you used the recommended script it would have set the user and folder to run node red from to that of the user who ran the install script.
What folder are you running node-red-pi from?
Look in the node-red.service file to see the user and folder. You can find where that is using sudo systemctl status nodered
If those are not right you can edit that file accordingly.
Started Node-RED graphical event wiring tool.
1
undefined
2
undefined
3
undefined
4
undefined
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Object.join (path.js:1039:7)
at Object.<anonymous> (/usr/lib/node_modules/node-red/red.js:124:50)
Warning: The unit file, source configuration file or drop-ins of nodered.service
â—Ź nodered.service - Node-RED graphical event wiring tool
Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset:
Active: inactive (dead) since Mon 2020-10-26 07:09:54 MST; 1h 11min ago
Docs: http://nodered.org/docs/hardware/raspberrypi.html
Process: 28814 ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTI
Main PID: 28814 (code=exited, status=0/SUCCESS)
Oct 26 07:05:13 Pi-NodeRedAutomation Node-RED[28814]: file using your chosen key
Oct 26 07:05:13 Pi-NodeRedAutomation Node-RED[28814]: --------------------------
Oct 26 07:05:13 Pi-NodeRedAutomation Node-RED[28814]: 26 Oct 07:05:13 - [info] S
Oct 26 07:05:13 Pi-NodeRedAutomation Node-RED[28814]: 26 Oct 07:05:13 - [info] S
Oct 26 07:05:13 Pi-NodeRedAutomation Node-RED[28814]: 26 Oct 07:05:13 - [info] S
Oct 26 07:09:54 Pi-NodeRedAutomation Node-RED[28814]: 26 Oct 07:09:54 - [info] S
Oct 26 07:09:54 Pi-NodeRedAutomation Node-RED[28814]: 26 Oct 07:09:54 - [info] S
Oct 26 07:09:54 Pi-NodeRedAutomation systemd[1]: Stopping Node-RED graphical eve
Oct 26 07:09:54 Pi-NodeRedAutomation systemd[1]: nodered.service: Succeeded.
Oct 26 07:09:54 Pi-NodeRedAutomation systemd[1]: Stopped Node-RED graphical even
lines 1-18/18 (END)
nodered.service:
# systemd service file to start Node-RED
[Unit]
Description=Node-RED graphical event wiring tool
Wants=network.target
Documentation=http://nodered.org/docs/hardware/raspberrypi.html
[Service]
Type=simple
# Run as normal pi user - change to the user name you wish to run Node-RED as
User=pi
Group=pi
WorkingDirectory=/home/pi
Nice=5
Environment="NODE_OPTIONS=--max_old_space_size=512"
# uncomment and edit next line if you need an http proxy
#Environment="HTTP_PROXY=my.httpproxy.server.address"
# uncomment the next line for a more verbose log output
#Environment="NODE_RED_OPTIONS=-v"
#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS
ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS
# Use SIGINT to stop
KillSignal=SIGINT
# Auto restart on crash
Restart=on-failure
# Tag things in the log
SyslogIdentifier=Node-RED
#StandardOutput=syslog
[Install]
WantedBy=multi-user.target
ok, if I start the service from pi's home dir, I don't get the errors and node red starts, but my flows have all disappeared.
If I run from pi's home dir terminal version, my flows are present.
if I call "node-red-start" from root, the node red fails to start and I get the errors shown in the first post.
If I call "node-red-start" from /home/pi, node red starts, but all of my flows are gone.
Warning message:
Warning: The unit file, source configuration file or drop-ins of nodered.service changed on disk. Run 'systemctl daemon-reload' to reload units.
in your root directory there will be a (hidden) directory call .node-red - all your flows should be in there.
The easiest would be to copy the entire .node-red directory over to your /home/pi/ directory - you will then have to change ownership of the files so that the pi user can read them - run as user pi sudo cp -R /root/.node-red ~/ && sudo chown -R pi:pi ~/.node-red
OK - lets rewind . When you run - node-red-pi and it works... - in the console log it should report the user directory and the flow file name... what are they ?
26 Oct 09:16:06 - [info] Node-RED version: v1.2.2
26 Oct 09:16:06 - [info] Node.js version: v12.18.3
26 Oct 09:16:06 - [info] Linux 5.4.51-v7l+ arm LE
26 Oct 09:16:07 - [info] Loading palette nodes
26 Oct 09:16:10 - [info] Dashboard version 2.23.4 started at /ui
26 Oct 09:16:10 - [info] Settings file : /home/pi/.node-red/settings.js
26 Oct 09:16:10 - [info] Context store : 'default' [module=localfilesystem]
26 Oct 09:16:10 - [info] User directory : /home/pi/.node-red
26 Oct 09:16:10 - [warn] Projects disabled : editorTheme.projects.enabled=false
26 Oct 09:16:10 - [info] Flows file : /home/pi/.node-red/flows_Pi-NodeRedAutomation.json
26 Oct 09:16:10 - [info] Server now running at http://127.0.0.1:1880/