Not having any luck updating

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)

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.

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

Ok, here is the results:

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.

},
  "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:

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.

Did you restart Node-RED?

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.

HURRAY!

0.2.2

I wonder how many more I can do this way?

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

   "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!

1 Like

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?

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

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.

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

@TotallyInformation

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

It will not have helped here.

If package.json contains:

"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

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

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.

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.

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.

@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

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?

That is my understanding (edit: that it will in most cases install the latest version) - 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.

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.