Unable to update node.js

I can't use that feature (yet) because my settings.js does't have the "httpsRefreshInterval".
I'm still investigating but it is due to the fact that httpsRefreshInterval requires "Node.js 11 or later".
My RPi4 had an older version of Node-RED, Node.js and npm.
I succesfully updated node-RED (using the instructions here [https://nodered.org/docs/getting-started/raspberrypi] ) but npm and Nodejs update are failing.
My current configuration is:
[info] Node-RED version: v1.2.6
[info] Node.js version: v10.21.0

I tryed various way to update Node.js and npm with no success....Any idea ?

You will get a better response if you start a fresh topic with that issue, and it will also keep this thread on-topic.

Moved from Node-RED SSL using Letsencrypt & Certbot as was off-topic.

Once you resolve your node.js issue, here is the updated section for your settings.js
Just replace your existing https section with the below

    // The following property can be used to enable HTTPS
    // See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
    // for details on its contents.
    // This property can be either an object, containing both a (private) key and a (public) certificate,
    // or a function that returns such an object:
    //// https object:
    //https: {
    //  key: require("fs").readFileSync('privkey.pem'),
    //  cert: require("fs").readFileSync('cert.pem')
    ////https function:
    // https: function() {
    //     // This function should return the options object, or a Promise
    //     // that resolves to the options object
    //     return {
    //         key: require("fs").readFileSync('privkey.pem'),
    //         cert: require("fs").readFileSync('cert.pem')
    //     }
    // },

    // The following property can be used to refresh the https settings at a
    // regular time interval in hours.
    // This requires:
    //   - the `https` setting to be a function that can be called to get
    //     the refreshed settings.
    //   - Node.js 11 or later.
    //httpsRefreshInterval : 12,
1 Like

The script will accept nodejs 10 as being a valid version. To force it to upgrade
sudo apt remove nodejs
and run the install script again. That will install 12 I think (or maybe 14, not sure).

1 Like

Thanks very much Colin,
It didn't update without a previous removal (as you suggested).
Also I found that my attempts installed the latest version of nodejs to /usr/local but was not seen by Node-RED.

The version installed is the 12.20.0.

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