Node-red-contrib-i2c is unsupported

The node-red-contrib-i2c is saying unsupported in NodRed version 2.2.2

npm -v 8.5.0

The I2C is working on the console, so looks like somthenthing with nodred.
With NodRed 2.2.0 it works great.

Is there somthing I can do to fix ?

Show us the exact error message and explain how/where it was shown.

Hi hardillb, please see screenshot attached.
I added the other nodes from this library to see what they say. But it's the same.

hanks

Look in the Node-RED logs (the system console not the browser) it should have printed an error message.

Hi,
4 Apr 10:14:28 - [info] Starting flows
4 Apr 10:14:28 - [info] [i2c in:I2C IO IN] Couldn't load i2c-bus, is your platform supported ?
Error: The module '/home/pi/.node-red/node_modules/i2c-bus/build/Release/i2c.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1187:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at bindings (/home/pi/.node-red/node_modules/bindings/bindings.js:112:48)
at Object. (/home/pi/.node-red/node_modules/i2c-bus/i2c-bus.js:4:32)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at module.exports (/home/pi/.node-red/node_modules/node-red-contrib-i2c/i2c/26-i2c.js:4:19)
at loadNodeSet (/usr/local/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js:365:27)
at /usr/local/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js:459:31 {
code: 'ERR_DLOPEN_FAILED'
}
4 Apr 10:14:28 - [info] [i2c in:I2C IO IN] Couldn't load i2c-bus, is your platform supported ?
Error: The module '/home/pi/.node-red/node_modules/i2c-bus/build/Release/i2c.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing

I already did:

pi@nodered:~ $ npm install node-red-contrib-i2c

up to date, audited 6 packages in 3s

found 0 vulnerabilities

and

npm rebuild

I don't know how npm works but maybe its needs fully removing and then re-installing?

You need to run npm rebuild from in the userDir not your home directory (which is what your last post shows).

The default useDir is /home/pi/.node-red

1 Like

Have you installed n or nvm?

What does running the 2 below commands show you? ...

node --version
sudo node --version

Lastly, have you recently updated node-js?

pi@nodered:~ $ :point_left: this is the wrong directory.
You should be in /home/pi/.node-red before running npm

[edit]
What @hardillb says

Hi hardillb and all,

thanks a lot, the dir was the issue.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.