Error when installing via script onto brand new Raspberry Pi Zero with Trixie

Trying to install using the script (here) onto a brand new Raspberry Pi Zero running Trixie (nothing else installed yet), but apparently installing Node.js the problem.

After getting the above error the first time, I did sudo apt-get update and then ran the script again, but get the same error.

Fixed by installing npm (sudo apt install npm), but is this something new with Trixie? I installed the "lite" OS version (sans desktop), so perhaps that version does not include npm.

No. That isn't the solution. The nodejs install should include npm. @dceejay is the expert in this area.

I installed Node-red on a Raspberry pi zero 2 with no problems.

1 Burn RPiOS lite Trixie 64 bit to sd card.
2 sudo apt update && sudo apt full-upgrade.
3 Run Node-red install script.
4 sudo systemctl enable nodered
5 reboot.

I think the nodejs install on a Zero is different, so that may be a factor. I haven't got a spare non-zero or to try it on.

It may well be different. I have retired all 32 bit, single core pies.

@grant1 what do these commands show (just the first few lines of each, if they show loads of entries)
apt policy nodejs
also
apt policy npm
and
which nodejs
which npm

Somehow it has installed the default repo version of nodejs which doesn't include npm (as you found) rather than the Nodesource version - our script should remove/replace it if you specify --node20 (or --node22) - but I haven't checked out Trixie yet - will do so tomorrow.

OK - just tried a clean install of Trixie minimal on a PiZeroW - and just ran the install script - all OK... so yes for some reason you had pre-installed nodejs and it didn't handle it well... I have also now tried to re-create that situation by apt installing nodejs and can confirm re-running the script with --node22 also cleans it up OK.

Thank you for the testing. I have another Pi Zero that I to set up soon with Trixie minimal then Node-RED, and will report back on what happens (hopefully nothing as you found).

just don't try and install nodejs first :slight_smile:

If you do have a problem then post the log file, /var/log/nodered-install.log