# Not having any luck updating

**URL:** <https://discourse.nodered.org/t/not-having-any-luck-updating/7471>\
**Category:** General\
**Created:** [1 February 2019 11:30 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471 "2019-02-01T11:30:03Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:23 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/21 "2019-02-01T13:23:44Z")

</div>

> [@TotallyInformation](#):
>
> As I went through previously - **not** `sudo` to clean the local cache, `sudo` to clean the global cache.

I only wanted to be sure I was not doing the wrong thing.

Luckily I didn't do `sudo`.

(Nick's command is done. Shall post now)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2019 13:24 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/22 "2019-02-01T13:24:13Z")

</div>

> [@Trying\_to\_learn](#):
>
> I'm confused.  
> You have:  
> `npm update`  
> But then you have:  
> `npm run update` and everything is updated.
> 
> Which is it?
> 
> Sorry. I can't resolve the confusion.

Ah, forgot about that, my bad. I actually simplified my file but in the process created a confusion. You are right, I should have called the one with the `run` in it a different name!

In truth, you don't need that in the scripts, just run `npm update`.

I have more in my package.json because of the way that I run Node-RED.

The real point is that checking the output from `npm outdated` is really useful and should save you from getting confused like this.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2019 13:25 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/23 "2019-02-01T13:25:53Z")

</div>

> [@Trying\_to\_learn](#):
>
> Luckily I didn't do `sudo` .

It wouldn't have done any harm, only slowed down your next global install/check/etc.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:31 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/24 "2019-02-01T13:31:25Z")

</div>

> [@knolleary](#):
>
> Please then provide:
> 
> 1. the output of that command.
> 2. what `~/.node-red/node_modules/node-red-contrib-simple-message-queue/package.json` says its `version` is
> 
> Right now, I _cannot_ explain why this Pi is behaving like this. Right now I'm focussed on trying to help you get it upgraded.

Ok, here is the results:

```auto
pi@TimePi:~/.node-red $ npm install node-red-contrib-simple-message-queue@0.2.2
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

+ node-red-contrib-simple-message-queue@0.2.2
updated 1 package and audited 875 packages in 242.011s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
pi@TimePi:~/.node-red $ 

```

Part 2:  
Forgive the formatting.

```auto
},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "version": "0.2.2"
}
pi@TimePi:~/.node-red/node_modules/node-red-contrib-simple-message-queue $ 

```

Hang on!

Firefox.... SHIFT RELOAD page.

This is what I see:

 ![Screenshot%20from%202019-02-02%2000-27-38](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/effda7d5065163cff6567b4c2569b9374def862e.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:32 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/25 "2019-02-01T13:32:39Z")

</div>

> [@TotallyInformation](#):
>
> Ah, forgot about that, my bad. I actually simplified my file but in the process created a confusion. You are right, I should have called the one with the `run` in it a different name!

Hey, who am I to get upset.

Every one goofs.

All good.

I think something is happening - re: my last reply to Nick with what is happening.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 13:32 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/26 "2019-02-01T13:32:48Z")

</div>

> [@Trying\_to\_learn](#):
>
> Hang on!
> 
> Firefox.... SHIFT RELOAD page.
> 
> This is what I see:

Did you restart Node-RED?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:35 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/27 "2019-02-01T13:35:42Z")

</div>

Nick,

I'll be honest and say No.

However, all the other times I went though the motions I did.  
But mine didn't have that extra bit on the end.

Standby for update.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:38 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/28 "2019-02-01T13:38:46Z")

</div>

HURRAY!

0.2.2

I wonder how many more I can do this way?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2019 13:39 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/29 "2019-02-01T13:39:52Z")

</div>

> [@Trying\_to\_learn](#):
>
> I'll be honest and say No.

Another reason to have your own update script in npm. Maybe something like this:

```json
   "updatenow": "npm update && sudo systemctl restart nodered",

```

and run from the command line with `npm run updatenow` which will do the updates and then restart Node-RED automatically.

When you install updates from within the admin ui, you don't need to restart of course because Nick is far too kind to us!

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:42 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/30 "2019-02-01T13:42:10Z")

</div>

> [@TotallyInformation](#):
>
> Another reason to have your own update script in npm. Maybe something like this:
> 
> ```auto
> "updatenow": "npm update && sudo systemctl restart nodered",
> 
> ```

I fully agree.

Not wanting to sound like I am making excuses, but my "method" was:  
from the CLI, do the `npm install ......` then restart node-red.  
But if there are multiple nodes to do, I would do them all first then restart NR.  
Seems silly restarting it 5 times to update 5 nodes.

Or is it better to do it with 5 restarts?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2019 13:42 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/31 "2019-02-01T13:42:56Z")

</div>

> [@Trying\_to\_learn](#):
>
> Or is it better to do it with 5 restarts?

Nope, but running just `npm update` updated **everything** , you don't need to do them individually.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:43 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/32 "2019-02-01T13:43:49Z")

</div>

Sorry Nick and Totally.... Before you get another reply in, I just want to check.

So do I need to:  
`npm outdated`  
and  
`npm run update`

`npm update` ???? I thought you said `npm run update`.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2019 13:44 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/33 "2019-02-01T13:44:32Z")

</div>

> [@Trying\_to\_learn](#):
>
> Sorry Nick and Totally.... Before you get another reply in, I just want to check.
> 
> So do I need to:  
> `npm outdated`  
> and  
> `npm run update`

No, `npm outdated` and `npm update`. (sorry again, that was my fault).

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 13:44 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/34 "2019-02-01T13:44:38Z")

</div>

@TotallyInformation

`npm update` will **not** update a module beyond what the package.json allows.

It will **not** have helped here.

If `package.json` contains:

```auto
"node-red-contrib-simple-message-queue": "~0.0.2"

```

Then `npm update` will **not** update that node to 0.2.2 because `0.2.2` does not satisfy the `~0.0.2` version in the package file

> [@Trying\_to\_learn](#):
>
> Sorry Nick and Totally.... Before you get another reply in, I just want to check.
> 
> So do I need to:  
> `npm outdated`  
> and  
> `npm run update`

Running `npm outdated` will give you some information about what updates are available.

> [@TotallyInformation](#):
>
> ```auto
> pi@pi3:~/nrlive/.data $ npm outdated
> Package Current Wanted Latest Location
> node-red-contrib-bigtimer 2.0.8 2.1.3 2.1.3 node-red-nrlive
> node-red-contrib-telegrambot 4.8.0 4.8.0 5.1.5 node-red-nrlive
> node-red-dashboard 2.13.0 2.13.2 2.13.2 node-red-nrlive
> pi@pi3:~/nrlive/.data $
> 
> ```

The Current column tells you what you have. The Wanted column tells you what `npm update` would upgrade you to _if_ you ran it. The Latest column gives you what the very latest version available is. Your package.json file will determine what the Wanted column shows. If you want to upgrade to the Latest version, you need to use the `npm install packagename@version` command.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:47 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/35 "2019-02-01T13:47:41Z")

</div>

Ok.

I wasn't (and I'm sorry for not being more clear. While this was happening a couple of urgent events happened and needed fast response.) meaning to add the @0.2.2 to all the nodes.

I was more meaning adding the @nnnnn to the end of the name and the nnnn being the latest number listed in the palette for the node.

Back on station now.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 February 2019 13:49 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/36 "2019-02-01T13:49:13Z")

</div>

Oh, to also be 100% so every one is on the same page:

I have not done the `npm update`.

There are about another 4 or 5 nodes saying they need updating.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 13:50 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/37 "2019-02-01T13:50:57Z")

</div>

@Trying_to_learn - please read my now edited reply above. It explains what `npm outdated` does and what role `npm update` will play.

In many cases `npm update` will _not_ get you the latest version. Use the `npm install package@version` command to do that for each module in turn

---

<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:** [1 February 2019 13:51 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/38 "2019-02-01T13:51:46Z")

</div>

A question from me.  
I know that `npm update` will only update to the latest version that is compatible with the specification in my package.json file. This, I assume, is the reason that @Trying_to_learn found that npm update was not updating to the absolute latest version. The question is, should `npm install` always install the latest version, or does it also obey the spec in package.json?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 13:54 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/39 "2019-02-01T13:54:28Z")

</div>

> [@Colin](#):
>
> The question is, should `npm install` always install the latest version, or does it also obey the spec in package.json?

That is my understanding (edit: that it will in most cases install the latest version) - [https://docs.npmjs.com/cli/install](https://docs.npmjs.com/cli/install)

But, as I said before, I cannot explain why that hasn't been the case here. Right now I'm not interested in explaining it until @Trying_to_learn has successfully upgraded his modules and is back on track.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 February 2019 13:54 UTC](https://discourse.nodered.org/t/not-having-any-luck-updating/7471/40 "2019-02-01T13:54:47Z")

</div>

> [@Colin](#):
>
> The question is, should `npm install` always install the latest version, or does it also obey the spec in package.json?

No, it behaves exactly the same way. However, you can override the behaviour manually with the install command that Nick gave. This also updates your package.json dependency list.

[Previous page](https://discourse.nodered.org/t/not-having-any-luck-updating/7471.md?page=1)

[Next page](https://discourse.nodered.org/t/not-having-any-luck-updating/7471.md?page=3)
