I have just run the bash <(curl... script to install node-red on a pi-zero running raspbian lite. It is all working ok but I am confused by something.
The first time round I got stuck in the node-Red not fully installed loop wanting to run re-run the script so I removed /usr/lib/node_modules and usr/bin/node, checked that node -v showed command not found and re-ran the script, and all seems to be working ok. However I am confused about how nodejs has been installed. I see
$ node -v
v10.15.3
$ npm -v
6.9.0
$ which node
/usr/bin/node
$ which npm
/usr/bin/npm
and there is no nodesource repo in /etc/apt/sources.list.d so I don't understand how node has been installed.
During the script it showed
Stop Node-RED ✔
Remove old version of Node-RED ✔
Remove old version of Node.js ✔
Install Node.js for Armv6 ✔ Node v10.15.3 Npm 6.9.0
Clean npm cache ✔
Install Node-RED core ✔ 0.19.6
Move global nodes to local -
Install extra Pi nodes -
Npm rebuild existing nodes -
Add shortcut commands ✔
Update systemd script ✔
The relevant section of the install log has
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
dpkg: warning: ignoring request to remove nodejs which isn't installed
dpkg: warning: ignoring request to remove node which isn't installed
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js
+ npm@6.9.0
added 54 packages from 9 contributors, removed 15 packages and updated 47 packages in 372.011s
So the question is, how has nodejs been installed?
Sorry, I am missing something. How does that relate to the fact that apt-cache policy nodejs says it is not installed, and in the pi install script I see
if curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - 2>&1 | sudo tee -a /var/log/nodered-install.log >>/dev/null; then CHAR=$TICK; else CHAR=$CROSS; fi
which I thought was adding the nodesource repository so nodejs could be installed from there.
Also as This method does NOT use apt - then the apt-cache will say a) that it's isn't installed and b) that the version available is 8.11 (or whatever)... This is an ongoing issue with Debian and one of the reasons the pre-built Pi package is recommended to be updated as soon as you can
I don't think you are right about not using apt on a non-zero pi. Having fetched the nodesource repo the script uses apt to install from there, so on a pi 3 it shows something like