It says successfully loaded, but I cannot start either from window or Programming-Node-Red at VNC...
What am I doing wrong?
Did you manually install nodejs version 15.9? That is not a supported version, though it does not mean that that is the problem. To rule it out, however, I would start by removing nodejs and then re-running the script, which will install a supported version. You should be able to remove nodejs by doing
apt remove nodejs
If it still doesn't work then post install log here (it tells you where it is at the end of the script). The log may have multiple runs of the script there so just post the last one.
See this post for details of the best way of posting logs and flows - How to share code or flow json
Upon trying:
pi@raspberrypi:~ $ apt remove nodejs
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
sudo apt remove nodejs
From var/node-red log
Started : Tue 23 Feb 2021 09:44:08 AM CST
Running for user pi at /home/pi
Found global nodes: :
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
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 0 not upgraded.
Already have nodejs v15.9.0
Now install nodejs
Versions: node:v15.9.0 npm:7.5.4
Now install Node-RED
sudo: npm: command not found
Now create basic package.json for the user and move any global nodes
Installing extra nodes: node-red-node-pi-gpio@latest node-red-node-random@latest node-red-node-ping@latest node-red-contrib-play-audio@latest node-red-node-smooth@latest node-red-node-serialport@latest :
up to date in 12s
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for pi
ln: failed to create symbolic link '/usr/bin/python': File exists
Now add launcher to top bar, add cpu temp example, make sure ping works
The user `pi' is already a member of `gpio'.
Memory : 7.8G
Finished : Tue 23 Feb 2021 09:44:08 AM CST
Seems you didnt remove nodejs v15 before re-running node-red install script?
That is actually the original cause of the problem. Somehow you have an unsupported version of nodejs but don't have npm installed at all.
Remove nodejs as I suggested (but using sudo, I just assumed you would know that, which I should not have done) then rerun the script.
@dceejay, this seems to be a bit of a hole in the install script. If nodejs is already installed, but npm is not then it does not take appropriate action.
[Edit] Actually something very odd is going on, as it has
which suggests node and npm must be installed locally, or something similar. Exploring this in later posts.
pi@raspberrypi:~ $ sudo apt remove nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $
What do these commands show
node -v
and
which node
How did you get to this situation? You said it is a new pi 4, but somehow you have a messed up or unusual system.
pi@raspberrypi:~ $ node -v
v15.9.0
pi@raspberrypi:~ $ which node
/home/pi/.config/nvm/versions/node/v15.9.0/bin/node
pi@raspberrypi:~ $
Started : Tue 23 Feb 2021 10:41:09 AM CST
Running for user pi at /home/pi
Found global nodes: :
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
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 0 not upgraded.
Already have nodejs v15.9.0
Now install nodejs
Versions: node:v15.9.0 npm:7.5.4
Now install Node-RED
sudo: npm: command not found
Now create basic package.json for the user and move any global nodes
Installing extra nodes: node-red-node-pi-gpio@latest node-red-node-random@latest node-red-node-ping@latest node-red-contrib-play-audio@latest node-red-node-smooth@latest node-red-node-serialport@latest :
up to date in 2s
Now add the shortcut and start/stop/log scripts to the menu
Now add systemd script and configure it for pi
ln: failed to create symbolic link '/usr/bin/python': File exists
Now add launcher to top bar, add cpu temp example, make sure ping works
The user `pi' is already a member of `gpio'.
Memory : 7.8G
Finished : Tue 23 Feb 2021 10:41:09 AM CST
Using this setup,
That is the problem, you are using nvm. Don't do that. Uninstall nvm and delete the folder .nvm
then run the script again.
I thought the script checked for nvm and produced a warning, but it doesn't seem to be there.
[Edit] Also delete .config/nvm
You guys rock...
Deleted nvm, re-run script and life is good again...
This time when it loaded Node-Red, it took about 20 minutes, but showed a version 12.21, I believe...
To all who input, thank you...
Just to finish this off, I have been in communication with the author of the blog you followed and helped him work through some issues he had with the install script. He is in the process of updating the blog to reference the recommended script.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.