# Unable to update node.js

**URL:** <https://discourse.nodered.org/t/unable-to-update-node-js/37264>\
**Category:** General\
**Created:** [9 December 2020 17:41 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264 "2020-12-09T17:41:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![catonia](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@catonia](https://discourse.nodered.org/u/catonia)\
**Post date:** [9 December 2020 17:41 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264/1 "2020-12-09T17:41:53Z")

</div>

\<\<...\>\>  
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](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 ?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [9 December 2020 18:02 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264/2 "2020-12-09T18:02:56Z")

</div>

~~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](https://discourse.nodered.org/t/node-red-ssl-using-letsencrypt-certbot/17606/45) as was off-topic.  
@catonia

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [9 December 2020 18:53 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264/3 "2020-12-09T18:53:23Z")

</div>

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

```auto
    // 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,

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 December 2020 20:30 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264/4 "2020-12-09T20:30:53Z")

</div>

> [@catonia](#):
>
> I tryed various way to update Node.js

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).

---

<div class="post-metadata">

**Author:** ![catonia](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@catonia](https://discourse.nodered.org/u/catonia)\
**Post date:** [10 December 2020 10:10 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264/5 "2020-12-10T10:10:32Z")

</div>

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.  
Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 February 2021 10:10 UTC](https://discourse.nodered.org/t/unable-to-update-node-js/37264/6 "2021-02-08T10:10:32Z")

</div>

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