Rpi-dht22 node RasPi 5 Bookworm "TypeError: failed to initialize"

Hi, I am trying to set up a DHT22 on my Raspberry Pi 5 which is running Bookworm. When I run the flow I get the following error "TypeError: failed to initialize"

I previously had the node working on a Rasberry Pi 4b but I understand that there is a difference between the two boards.

I tried installing using the following commands:

sudo apt install libgpiod-dev
npm rebuild node-gyp
npm install node-dht-sensor --use_libgpiod=true
sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor

But the node didn't show up in my palette so I installed using palette manager

Has anyone manged to make this work? And if so how?

Thanks in advance for your help

Update I have just had a look in my service logs and I can see the following:

11:42 AM

30 Apr 11:42:57 - [error] [rpi-dht22:2bede84240645890] TypeError: failed to initialize

Node-RED

11:42 AM

bcm2835_init: Unable to open /dev/gpiomem: No such file or directory

Node-RED

Did you follow the instructions about installing node-dht-sensor and root access in the readme? node-red-contrib-dht-sensor (node) - Node-RED

There are many reports of various gpio related nodes failing to work on RPiOS Bookworm, including node-red-contrib-dht-sensor, which has open issues around this going back 3 years.

There are Bash and Python scripts which can read/set gpios in Bookworm. You may find these practical to use, via the exec node.

Alternatively, connect your sensor to a cheap ESP32 module running Tasmota and exchange messages with Node-red over wifi with MQTT.

Thanks for the replies. I really want it running off the Raspberry Pi, I don't know how to use the python scripts in an exec node. I also have a BME280 sesnor do you know if they work out of the box with a Raspberry Pi 5?

Pretty sure they don't.
I believe the basic issue is that the IO hardware on the Pi5 was changed, but Node-red on any Pi running Bookworm is likely to have problems with GPIOs.

I do have BME280 and BME680 sensors. I do not have a Pi 5 and I am very reluctant to connect wires to my Pi 4 GPIO pins. It's too easy to kill the Pi.
They are connected instead to ESP boards running Tasmota and (once Tasmota is configured) send the readings automatically over MQTT.

There are suggested fixes online.
If you do manage to get it working, please come and describe your method for the benefit of others!

I think the issue is the Pi 5. I don't have issues with GPIO on bookworm on an earlier pi.