Nodejs/NPM version problem

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Post Reply
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Nodejs/NPM version problem

Post by Bospieper »

Hi,
I've tried several times to install Zigbee2MQTT following the instructions from the documentation of Koenkk.
When I start npm, after installation, with the command npm start the first error is a version error. The nodejs version is 10.24.0 and the npm version is 5.8.0
Every time doing a fresh install these versions are installed.The error is : npm does not support node.js v10.24.0 you should probably upgrade to a newer version of node .
Wich npm version does support a the proper nodejs version compatible with the zigbee2mqtt installation and wich command should I use for that?
RPI 4 with Buster 10
Grz.Piet
User avatar
FireWizard
Posts: 1968
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Nodejs/NPM version problem

Post by FireWizard »

Hello @Bospieper,

According to Koenkk's documentation (https://www.zigbee2mqtt.io/guide/instal ... ermissions) npm version 6.X or 7.X should be installed

For installation see the chapter Installation in the link above.

Regards
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: Nodejs/NPM version problem

Post by Bospieper »

# Install Node.js and required dependencies
# In Debian/Raspbian bullseye and up (11 and up), NodeJS v12.X is packaged, this is the safest method of installing NodeJS (from official repositories) for Zigbee2MQTT. Older i386 hardware can work with [unofficial-builds.nodejs.org](https://unofficial-builds.nodejs.org/do ... /v12.16.3/ e.g. Version 12.16.3 should work.
# Check https://github.com/nodesource/distribut ... /README.md if you want to install a specific version from NodeJS repositories instead.
sudo apt-get install -y nodejs npm git make g++ gcc

# Verify that the correct nodejs and npm (automatically installed with nodejs)
# version has been installed
node --version # Should output v10.X, v12.X, v14.X, v15.X or V16.X
npm --version # Should output 6.X or 7.X
Is this what you mean?
User avatar
FireWizard
Posts: 1968
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Nodejs/NPM version problem

Post by FireWizard »

Hi @Bospieper,

Yes, indeed, this is what I mean.
But if you search the Internet on how to install NodeJS and npm, you will find several, similar, posts.

Regards
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: Nodejs/NPM version problem

Post by Bospieper »

When I following the installation instructions version 10.24.0 of Nodejs is installed en version 5.8.0 of NPM so I have to manually install a version by wich the NPM version is higher then 5.8.0 with a compatible version of Nodejs. Can you tell me how to do that?
Grz. Piet
User avatar
FireWizard
Posts: 1968
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Nodejs/NPM version problem

Post by FireWizard »

Hello @Bospieper,

As your target indicates Raspberry PI you can try to follow the steps as described at https://www.makersupplies.sg/blogs/tuto ... spberry-pi

Note the following:

I do run Node RED also on a Raspberry Pi 1B and this is armv6l
I have installed node v 14.18.1 and npm 8.5.0
I had issues after I tried to install node v16 on this RPi1B

On another Pi (RPi3B+) which is armv7l, I have installed v16.14.2 and npm 8.5.0
Be aware that v12 will go end of life April 30 this year.

See: https://nodejs.org/en/about/releases/

I would recommend to go for v16 LTS, unless you have an armv6l Raspberry.

Regards
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: Nodejs/NPM version problem

Post by Bospieper »

Thanx for your advice.
From the Internet I followed the following instruction to install Nodejs vs 12.X
sudo apt update
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
then
sudo apt -y install nodejs
sudo apt -y install gcc g++ make
and ended up with version 17.x instead of 12.x. And version 17.x is to high for zigbee2mqtt.
So I really don't know how to install a version wich is higher than NPM version 5.8.0 and is compatible with Nodejs and is sufficient for Zigbee2mqtt
User avatar
FireWizard
Posts: 1968
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Nodejs/NPM version problem

Post by FireWizard »

Hello @Bospieper,

These commands are different from the ones in the link in my previous post.

You will find there:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
uname -m
wget https://nodejs.org/dist/v16.14.2/node-v16.14.2.tar.gz
tar -xzf node-v16.14.2.tar.gz
cd node-v16.14.2.tar.gz
sudo cp -R * /usr/local/
node -v
npm -v
These commands should do it, at least if you have an armv7l architecture.

Regards
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: Nodejs/NPM version problem

Post by Bospieper »

Hi,
Unfortunately this installation end up with version 17.8.0. Is it possible that version information kept elsewhere in the system and has no affect on the sudo apt purge nodejs command?
Attachments
nodejs.jpg
nodejs.jpg (138.57 KiB) Viewed 4168 times
User avatar
FireWizard
Posts: 1968
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Nodejs/NPM version problem

Post by FireWizard »

Hello @Bospieper

Your download has been successful, but unfortunately somewhere in your path an old version 17.8.0 is still installed.
It also looks as there are (at least) 2 versions of v16.14.2 been stored. See: node-v16.14.2.tar.gz.1.
There is still also a file called node-v16.14.2.tar.gz, otherwise it would not have been possible to extract that file.

So you have 2 files of node-v16.14.2.tar.gz and one installed version v17.
One version of v16 you will find in /usr/local

You have to remove v17 first.

How to uninstall it, depends on the way you installed it (apt, nvm or download/extract/copy (as we did just now))

Regards
User avatar
Bospieper
Posts: 174
Joined: Thursday 07 November 2019 10:26
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: NL
Contact:

Re: Nodejs/NPM version problem (SOLVED)

Post by Bospieper »

Hi,
After several options to deinstall Nodejs I finally manage to solve it.
Did a reinstall with version 16.x and now its reproducing the right version of Nodejs and NPM.
Zigbee2mqtt is working and all Zigbee devices are up and running.
Again thanx for your patience and advise.
Grz. Piet
User avatar
FireWizard
Posts: 1968
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Nodejs/NPM version problem

Post by FireWizard »

Hello Piet, (@Bospieper)

great, that it has been solved and that everything is working fine.
Can you mark the topic as solved?

Regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest