Updating npm does not work

openhabian 2024-03-16T22:19:25+01:00}(b09cef5) on Raspi 3+

I ran openhabian-config to do an update. Everything was working fine. I realized a message, which asked me to update npm.
So i did a
npm install -g npm@10.5.0
as requested and got the following error messages:

npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: npm@10.5.0
npm ERR! notsup Not compatible with your version of node/npm: npm@10.5.0
npm ERR! notsup Required: {“node”:“^18.17.0 || >=20.5.0”}
npm ERR! notsup Actual: {“npm”:“8.19.4”,“node”:“v16.20.2”}

npm ERR! A complete log of this run can be found in:
npm ERR! /home/openhabian/.npm/_logs/2024-03-26T08_43_55_781Z-debug-0.log

Maybe my npm version is older as expected. I can’t remember to have been ask to update npm before. Hm, you never know.

Is there any advice what to do?

not sure but why install with npm? What happens after

sudo apt-get install npm

While starting up “openhabian-config → 2 Upgrade System” i got the message to update as shown.

Via apt i get

Die folgenden Pakete haben unerfüllte Abhängigkeiten:
libnode72 : Kollidiert mit: nodejs-legacy
nodejs : Kollidiert mit: npm
E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.

So there seems to a problem with old npm/node.js versions.

I would try to remove node and npm and reinstall with apt.

After removing nodejs via apt, some dependencies stayed and “apt install …” still did not work (same error). So i installed nodejs manually.
After this i did another “apt install …”. No errors and everthing seems to be fine. No log errors, no strange system behaviour … up to now.

I red some stuff about problems with old versions which made me go for the manual install. Not a good idea normally. But it seemed to wok in this case.

Thanks for your support.

1 Like