Cannot Install or update nodes EBADENGINE running node 16.x

I am unable to install any nodes, as they all seem to be failing. Not sure what I did along the way but I am getting this error:

-----------------------------------------------------------
2022-06-02T20:59:46.540Z Install : node-red-contrib-uibuilder 5.0.2

2022-06-02T20:59:45.972Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-uibuilder@5.0.2
2022-06-02T20:59:46.935Z [err] npm
2022-06-02T20:59:46.935Z [err]  
2022-06-02T20:59:46.936Z [err] WARN config production Use `--omit=dev` instead.
2022-06-02T20:59:53.287Z [err] npm
2022-06-02T20:59:53.287Z [err]  ERR! code EBADENGINE
2022-06-02T20:59:53.289Z [err] npm ERR!
2022-06-02T20:59:53.289Z [err]  engine Unsupported engine
2022-06-02T20:59:53.289Z [err] npm ERR! engine Not compatible with your version of node/npm: node-red-contrib-objectid@0.7.2
2022-06-02T20:59:53.289Z [err] npm 
2022-06-02T20:59:53.289Z [err] ERR! notsup Not compatible with your version of node/npm: node-red-contrib-objectid@0.7.2
2022-06-02T20:59:53.289Z [err] npm ERR! notsup Required: {"node":"^0.12.7"}
2022-06-02T20:59:53.289Z [err] npm ERR! notsup Actual:   {"npm":"8.11.0","node":"v16.14.2"}
2022-06-02T20:59:53.291Z [err] 
2022-06-02T20:59:53.292Z [err] npm ERR!
2022-06-02T20:59:53.292Z [err]  A complete log of this run can be found in:
2022-06-02T20:59:53.292Z [err] npm ERR!     /home/ubuntu/.npm/_logs/2022-06-02T20_59_46_887Z-debug-0.log
2022-06-02T20:59:53.301Z rc=1

Requires node 0.12.7 ??
Actual is 16.14.2

I haven't the slightest idea what is going on. I tend to get tangled in npm and versioning mess from time to time, if that's what it is. Any sound solutions to accommodate old and new node version requirements?

You need to remove node-red-contrib-objectid - it requires node 0.12 which is not supported. It needs to be updated to not have such a limited engines requirement in its package.json - but as it hasn't been touched in 4 years, I'm not sure how likely that is to happen.

1 Like

Thanks Nick.

I'm kinda painted in a corner as my site is serving an animated film festival served via node-red.
streamtacular.com
Been working fine (so far) though the mongodb nodes I have requires the ObjectID object to pass to mongodb to query results.
I would have to essentially remove, and seemingly implement a newer version of mongodb as well, that is harmonious with "modern" versioning.

I was curious if syntax isn't completely different, if possible to "spoof" the version in the package.json? and redeploy?

I'm curious the 'innards' as to what causes the termination and error of the npm updates; based on incompatible versions. Does it simply reference the provided version number? Or is there something more entwined?
I want to avoid frankensteining my node-red / npm configs, though I am tempted due to my situation.

Thanks again for leading me in the right direction.

Well - to get control of this - you can clone that node's repo and try editing the package.json to remove the restriction and then load the node from local directory. Of course if the restriction is there for a real reason then you would then also have to fix the code locally as well but at least then it is under your control.

1 Like

Have you tried node-red-contrib-bson (node) - Node-RED (nodered.org) instead? I think it does the same thing but with updated code.

Update: Oops, they left the same restriction in the package.json, sorry.

Update2: The objectid and bson nodes are very simple wrappers around the npm bson package. So you could simply use a function node and load the bson library yourself.

2 Likes

I'm assuming I need to adjust the settings.js file for this and add bson to the global modules section.

It appears I've tried and paused my efforts:

    functionGlobalContext: {
        os:require('os'),
        domtoimage:require('dom-to-image'),
        stripe:require('stripe'),
        objectid:require('bson').ObjectID
//      flagpack:require('flagpack'),   
        //vimeo:require('vimeo'),
        // jfive:require("johnny-five"),
        // j5board:require("johnny-five").Board({repl:false})
    },

Now I just need to figure out what I need to do in the function node. Should be straight forward:

I'm thinking:

///msg.payload._id is an incoming string representing a mongodb ObjectID
const objectID = global.get('objectid');
msg.payload._id = objectID(msg.payload._id);
1 Like

OK So I did your suggestion and added the functionGlobalContext require of bson in settings.js and ran the code above before my mongo query. It is working and not affecting my site.

Thank you all.

2 Likes

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