Hi, on my PI 3B I've installed the last raspian buster (release data 2020-02-13 image with desktop based on Debian Buster). I'm getting mad, trying several time even reinstalling the OS, but I cannot install node-red in any way. I've tryed with the script, manually installing npm and nodejs ... but nothing.
Now the official script freeze for several hours on "install Node-RED core"
What happens if you run sudo npm install -g --unsafe-perm node-red
Please copy/paste the result rather than screenshot, if possible.
Edit actually, before trying that, run sudo apt update && sudo apt full-upgrade
And copy/paste here if that fails. If possible please supply a translation of the error message to English.
Further edit Having looked again at the previous error message I see you have somehow got an old version of npm installed, possibly because you installed it manually, so before doing either of the above run sudo apt remove nodejs npm nodered
ok, as soon as possible I'll be back with the result of the action you suggest.
Having looked again at the previous error message I see you have somehow got an old version of npm installed, possibly because you installed it manually
Blockquote Further edit Having looked again at the previous error message I see you have somehow got an old version of npm installed, possibly because you installed it manually
The first and only thing I did on the new OS was installed node-red via script. But since the beginning it went block at the same point. And even instaling it manually or by "reccomended software" it gave me the same error related to npm. So I uninstalled npm and jason and reinstall them manually in order to be sure to have the last version. But the errore still remain and node-red installation get block. For this reason you see npm already installed.
@ Colin
with "sudo apt remove nodejs npm nodered" it says that npm and nodered are not installed, than won't be removed. It only removed nodejs (10.19.0-1nodesource1)
with "sudo npm install -g --unsafe-perm node-red" it says
sudo: npm: command not found
pi@rw:~ $ sudo apt remove nodejs npm nodered
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
Il pacchetto "npm" non è installato e quindi non è stato rimosso
Il pacchetto "nodered" non è installato e quindi non è stato rimosso
I seguenti pacchetti saranno RIMOSSI:
nodejs
0 aggiornati, 0 installati, 1 da rimuovere e 0 non aggiornati.
Dopo quest'operazione, verranno liberati 77,3 MB di spazio su disco.
Continuare? [S/n] s
(Lettura del database... 101239 file e directory attualmente installati.)
Rimozione di nodejs (10.19.0-1nodesource1)...
Elaborazione dei trigger per man-db (2.8.5-2)...
pi@rw:~ $ sudo npm install -g --unsafe-perm node-red
sudo: npm: comando non trovato
Unfortunately, you've confused the npm package installations with the apt package installations.
nodejs is installed via apt. npm and node-red are installed via npm (yes it is a little weird to have npm install itself and I'm glossing over the detail).
As you already seem to have removed nodejs, you can no longer remove npm or anything else that got installed by npm into the global location.
If you try the following commands, you should be able to see any remaining executable files which you can manually delete:
This was from my own Pi which isn't running buster but it should be similar for you.
In addtion, you will need to manually remove any globally installed modules and you should be able to find the /usr/lib/node_modules/ folder. You can safely delete the whole node_modules folder.
Not necessarily true. On a standard Raspbian install npm is available in the repository for installation with apt, and the OP said he had tried to do that, which is why I got him to remove them again with apt, in case they were installed. The node-red install script installs nodejs from the nodesource repository and that automatically installs npm too.
I don't know why the install script did not run the first time, but having investigated, it is not possible to use apt to install node red from the Raspbian Buster repository. I get the same issue you did that the version of npm in the repo is 5.8.0 but node red needs > 5.8.0. So there is a packaging error in the repository at the moment and it is not possible to install node-red via that route. I suspect that the error is that node-red actually requires >=5.8.0 rather than >5.8.0 but that is purely a guess.
I seem to have got to the bottom of this, or at least got significantly deeper into the hole.
Starting with a clean install of Raspbian Buster node red will install ok from the Raspbian repository, installing nodejs 10.15.2~dfsg-2+rpi1 and npm 5.8.0+ds6-4. However, starting again with a clean install, if one adds the nodesource repository for nodejs 10.x then that makes available nodejs 10.19.0-1nodesource1. Now node red will not install from Raspbian repository. It is not a direct dependency on npm that is the problem, it is much further down the chain of dependencies that there is a conflict, due, I imagine to the way that npm is installed when using the nodesource repository.
Looking at @Lupin_III's screenshot in the first post it can be seen that this cannot be the first time the script was run as it already has nodejs 10.19.0 which must have come from the nodesource repo, then for some reason it was unable to install node-red , but we have not got enough of the original install log to know why. However this happened the result was that the nodesource repo is enabled and once that is done one cannot install node-red from the Raspbian repo.
a) because it is there and is the only way to get listed in the "available software" list for the Raspbian distro - It used to be pre-installed on the default image - but they have pared that back to the essentials these days. Still is in the "full-install" if anyone uses that... all of which helps "discoverability"...
b) node10 is what buster has by default... debian is very slow at updating - but will no doubt get to 12 (or 14) at some point.
c) yes Node-RED is better installed from the script as that then uses later nodejs etc etc...
No I get that, I was just wondering about Colin's approach is all.
Ah, I didn't notice that with my recent build since I always install from the better supported repo as your script also does. So I naturally gravitate to the latest LTS version.
Or do-it-yourself and understand the details (and yes, I absolutely get that approach is not for everyone).
OK, it wasn't clear from your post I don't think. I didn't want people to become more confused.