Bme680 node producing no data

I've been using the node-red-contrib-bme680-rpi node happily for some time now.

I installed it on a new raspberry pi image and can't get it to generate any data. I see this error in the Node-RED logs:

2 Apr 13:16:53 - [error] [bme680rpi:7ee6176abf806608] TypeError: Bme680 is not a constructor

This is in Node-RED v4.0.9

Any ideas?

How did you install node red?

Post the node red startup log please.

What version of node-red were you using?
What OS version did you install on the new image and what version did you previously use?
There have been changes in the pi software and the node hasn’t been updated in 4 years. It may be that the node will not work with the new PI release.

You can open an issue on GitHub and see if the author will respond.

I installed it via the Node-RED supplied script for Raspberry Pi OS.

Welcome to Node-RED
===================
2 Apr 14:09:29 - [info] Node-RED version: v4.0.9
2 Apr 14:09:29 - [info] Node.js  version: v20.19.0
2 Apr 14:09:29 - [info] Linux 6.12.20+rpt-rpi-v8 arm64 LE
2 Apr 14:09:30 - [info] Loading palette nodes
This module is deprecated. Plase use another dependency
2 Apr 14:09:32 - [info] Settings file  : /home/dude/.node-red/settings.js
2 Apr 14:09:32 - [info] Context store  : 'default' [module=memory]
2 Apr 14:09:32 - [info] User directory : /home/dude/.node-red
2 Apr 14:09:32 - [warn] Projects disabled : editorTheme.projects.enabled=false
2 Apr 14:09:32 - [info] Flows file     : /home/dude/.node-red/flows.json
2 Apr 14:09:32 - [warn] Encrypted credentials not found
2 Apr 14:09:33 - [info] Server now running at http://127.0.0.1:1880/
2 Apr 14:09:33 - [info] Starting flows
2 Apr 14:09:33 - [info] [ui-base:My Dashboard] Node-RED Dashboard 2.0 (v1.22.1) started at /dashboard
2 Apr 14:09:33 - [info] [ui-base:My Dashboard] Created socket.io server bound to Node-RED port at path /dashboard/socket.io
2 Apr 14:09:33 - [error] [bme680rpi:7ee6176abf806608] TypeError: Bme680 is not a constructor
2 Apr 14:09:33 - [info] Started flows
2 Apr 14:09:33 - [info] [mqtt-broker:Localhost] Connected to broker: mqtt://localhost:1883

What pi os version did you install on the pi?

Both the old image that worked and the new one are both the current major release of Raspberry Pi os. The big difference is Node-RED v3 on the existing image and Node-RED v4 on the new image. I suspect this is what broke things.

It is unfortunate if node-red-contrib-bme680-rpi is not compatible with Node-RED v4 as it is the only node I can find that will read the Bosch BME 680 sensor. This is a pretty common sensor, I was surprised that this old node is the only one available.

You can easily confirm that it is node-red v4 that is the problem. Run this to return to NR 3.1.15

sudo npm install -g --unsafe-perm node-red@3.1.15

Then restart node-red using node-red-stop; node-red-start, check that it is using that version and see if you still get the error.

To return to the latest version:
sudo npm install -g --unsafe-perm node-red@latest
and restart node-red.

Ok, it doesn't seem to be NR 4 causing the problem. I'm getting the same error in NR 3.1.15.

This contribution timed out.

Check the version of nodejs used on the two systems. That is more likely to be the issue I think. Use node -v to check, or look at the node red startup log.

I can see the sensor with i2cdetect on address 77. So it is wired correctly and i2c communication is working.

That seems very reasonable that it would be the nodejs version.
node v18.20.6 <- works
node v20.19.0 <- fails

Have you confirmed that your new system works if you drop the nodejs version? You can run the install script with --node18 on the end to do that. If so then I suggest submitting an issue against the node, though whether it will get addressed is another issue.
This is a very common problem with nodes that are not maintained. Eventually a change in nodejs breaks it.

Unfortunately at this point I need to move on. I'll work around it.

I don't understand, do you mean that you haven't tested it with nodejs 18, but you can somehow work around it even though you get the error?

I've spent all the time I have for this. I will read the sensor outside Node-RED. Maybe later I can get back to this and confirm it and report it to the author of the node.