I am running Debian with Raspberry Pi Desktop which works fine but I cannot install node-red using the official script.
It gave the error:
Update Node.js LTS ✘ Failed to install Node.js - Exit
This are the last few lines from the log file, which is not helpful (in my opinion just a beginner)
Reading state information...
Suggested packages:
npm
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/86.3 kB of archives.
After this operation, 160 kB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database $
Preparing to unpack .../nodejs_10.15.2~dfsg-2_i386.deb ...
Unpacking nodejs (10.15.2~dfsg-2) ...
Setting up nodejs (10.15.2~dfsg-2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for man-db (2.8.5-2) ...
What do I wrong, The Raspberry desktop is a clean install on VmWare.
The script is meant for running on a real Pi or 64bit architecture - there is no longer a decent build for nodejs on 32 bit x86 architecture - so you will need to install nodejs by hand first (to not use the built in deb package), and then use the script to add Node-RED . Or use an Ubuntu VM
Oh, you said you had installed the desktop on Debian, what you mean is that you have installed Raspbian Buster.
What does this command show? apt policy nodejs
Sorry for the long text, but new users are not able to load attachments
***************************************
Started : Thu 23 Apr 2020 10:56:59 AM CEST
Running for user pi at /home/pi
Failed to stop nodered.service: Unit nodered.service not loaded.
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...
E: Unable to locate package nodered
Already have nodejs v10.15.2
Now install nodejs
Updating nodejs v10.15.2
Using nodesource.list
Removing nodejs v10
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Package 'nodejs-legacy' is not installed, so not removed
Package 'npm' is not installed, so not removed
The following packages were automatically installed and are no longer required:
libc-ares2 libnode64 libuv1 nodejs-doc
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
nodejs
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 160 kB disk space will be freed.
(Reading database ... 143192 files and directories currently installed.)
Removing nodejs (10.15.2~dfsg-2) ...
Processing triggers for man-db (2.8.5-2) ...
## Installing the NodeSource Node.js 12.x repo...
## Populating apt-get cache...
+ apt-get update
Hit:1 http://ftp.debian.org/debian buster InRelease
Hit:2 http://ftp.debian.org/debian buster-updates InRelease
Hit:3 http://archive.raspberrypi.org/debian buster InRelease
Hit:4 https://deb.nodesource.com/node_12.x buster InRelease
Hit:5 http://security.debian.org buster/updates InRelease
Reading package lists...
## Confirming "buster" is supported...
+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_12.x/dists/buster/Release'
## Adding the NodeSource signing key to your keyring...
+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
Warning: apt-key output should not be parsed (stdout is not a terminal)
OK
## Creating apt sources list file for the NodeSource Node.js 12.x repo...
+ echo 'deb https://deb.nodesource.com/node_12.x buster main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_12.x buster main' >> /etc/apt/sources.list.d/nodesource.list
## Running `apt-get update` for you...
+ apt-get update
Hit:1 http://security.debian.org buster/updates InRelease
Hit:2 http://ftp.debian.org/debian buster InRelease
Hit:3 http://archive.raspberrypi.org/debian buster InRelease
Hit:4 http://ftp.debian.org/debian buster-updates InRelease
Hit:5 https://deb.nodesource.com/node_12.x buster InRelease
Reading package lists...
## Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
npm
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/86.3 kB of archives.
After this operation, 160 kB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 143181 files and directories currently installed.)
Preparing to unpack .../nodejs_10.15.2~dfsg-2_i386.deb ...
Unpacking nodejs (10.15.2~dfsg-2) ...
Setting up nodejs (10.15.2~dfsg-2) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for man-db (2.8.5-2) ...
Not much help but I had an old stretch version of RPi for Desktop in VirtualBox vm so I gave the script a go on that and it failed on me as well - different error messages (stuff about nvm) but fail just the same
Maybe just use an 64bit Ubunutu VM like what @dceejay recommended if you want to try out NR on a VM?
Looking back I see that the nodejs install script has setup the repository http://ftp.debian.org/debian buster/main i386 Packages
which is a 32 bit repository as was pointed out earlier. I think the nodejs install script (which is not provided by node red) is not handling Raspbian on a Debian VM correctly.
To clarify - Raspbian is still a 32 bit operating system - whether for arm or intel processor. (As Pi doesn't yet go above 4GB there is no need for 64 bit.. So if you create a vm on a 64bit machine the vm will still be 32bit. No doubt that will change at some point - but that is not where we are.
As I said it's probably cleaner to go for an ubuntu vm on intel instead. Or there is another Debian based distro called Zoriin which has quite a nice UI.
A solution is not to use the install script, but to install the individual components by hand. I think this is detailed in the getting started guide. It is not particularly difficult.