Weird errors from m-bus

I got 3 m-bus nodes. On every deploy, each of them causes 2 errors:

Error: Error relocating /data/node_modules/node-mbus/build/Release/mbus.node: _ZN2v820EscapableHandleScopeC1EPNS_7IsolateE: symbol not found

TypeError: Cannot read properties of null (reading 'on')

So a total of 6 error messages.

node red: v4.0.8
node.js: v22
npm: v11
node-red-contrib-m-bus v 3.2.1

And indirectly node-mbus v2.2.4.

Asking chatgpt, it indicates potential issue with node.js v22:

Compatibility Issues:

    The node-mbus module might be compiled against an incompatible version of Node.js or a missing shared library.
    The error _ZN2v820EscapableHandleScopeC1EPNS_7IsolateE: symbol not found often indicates a mismatch between the Node.js runtime version and the node-mbus native bindings.

Initialization or Usage Issues:

    The TypeError: Cannot read properties of null (reading 'on') suggests that the node-mbus module or a related object failed to initialize properly.

However, according to ndoe-mbus it is updated for node.js v22.

Any clue what that is about?

As I discussed elsewhere, this mbus node doesn't produce any output or throw any errors to be caught with catch node. It's dead silent. Further, this error occurs on one node red machine, but not another. The one where it doesn't cause error had minor differences in versions, node.js v22.12.0 and node-red-contrib-m-bus v3.2.0. I upgraded those to latest so they match and are identical. And still the other node red works. So it must be something else?

After upgrading nodejs to 22, you should go into your .node-red directory and run
npm rebuild
to ensure any nodes that need building are rebuilt. If you did not do that then see if that helps. Restart node-red after the rebuild.

If it still doesn't work then the best thing is probably to post an issue on the node's github page and hope the author responds.

1 Like

I deleted docker container and image, then ran docker compose up again to start fresh. It may not include rebuild, but install.

Just to make sure, I exec into container and ran rebuild there. Not sure if the packages are in 2 duplicate locations? I only accessed the default /data/ folder inside the container, but there might be a separate node-red location also?

I have no idea how but I think you were spot on. After exec into container, cd /data and run npm rebuild, it seems to work now. Thanks a bunch!

Wouldn't think npm rebuild to be necessary since I've reset everything and run npm install?

I had missed that you were using Docker. In that case you should not need to rebuild, as the node install should do it anyway.

1 Like