Not having any luck updating

This is getting very frustrating.

I seem to be going in circles.

RPI 2B.

Raspberry Pi Model B Rev 2

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Raspberry Pi reference 2018-03-13
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 00013d7972122d1304aacda8fff5098f073ceb43, stage5

NR 0.19.5
NPM....

pi@TimePi:~ $ npm version
^C
pi@TimePi:~ $ npm
^C
pi@TimePi:~ $ npm --help
^C
pi@TimePi:~ $ npm ?
^C
pi@TimePi:~ $ 

(edited part)
man npm:

NPM(1)                                                                                           NPM(1)

NAME
       npm - javascript package manager

SYNOPSIS
         npm <command> [args]

VERSION
       6.4.1

Dashboard 2.13.2
(This has only just happened and I don't really know how it happened. It took multiple attempts and it somehow just - finally - worked.)

I have about 5 nodes I want to update.

This is an example of one:

pi@TimePi:~/.node-red $ npm install node-red-contrib-simple-message-queue
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.0.2
updated 1 package and audited 875 packages in 769.108s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
pi@TimePi:~/.node-red $ sudo systemctl restart nodered

So you can see I restarted Node-Red.

Went back to GUI/web page.

simple-message-queue version 0.0.2 update to 0.2.2

This is just beyond frustrating.

One of my other RPI's is quite happy. Don't know why or how.
It has been turned off more than it has been on recently.

This one is on 24/7.

The NUC is also pretty happy. Though it has a bit more grunt that the poor Pi.

What ever.

Please, someone.
Explain to me what is going on.

I am jumping through the hoops. Not worrying about the messages when I update from the terminal - as from the web page it just doesn't do anything.
It just (repeatedly) says it is updated and isn't after a restart.

So: all things being equal and doing what I was told; it should update.
Alas no one told it that.

Try npm cache clean and then try again

Getting this:

pi@TimePi:~ $ npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2019-02-01T11_42_16_305Z-debug.log
pi@TimePi:~ $ 

This is the log file mentioned. (Sorry)

pi@TimePi:~ $ cd .npm/_logs
pi@TimePi:~/.npm/_logs $ cat 2019-02-01T11_42_16_305Z-debug.log 
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'cache', 'clean' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose config Skipping project config: /home/pi/.npmrc. (matches userconfig)
5 verbose npm-session 33646676b4a09f7c
6 verbose stack Error: As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
6 verbose stack
6 verbose stack If you're sure you want to delete the entire cache, rerun this command with --force.
6 verbose stack     at clean (/usr/lib/node_modules/npm/lib/cache.js:72:22)
6 verbose stack     at EventEmitter.cache (/usr/lib/node_modules/npm/lib/cache.js:47:16)
6 verbose stack     at Object.commandCache.(anonymous function) (/usr/lib/node_modules/npm/lib/npm.js:159:13)
6 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:131:30)
6 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:132:7)
6 verbose stack     at process._tickCallback (internal/process/next_tick.js:181:9)
7 verbose cwd /home/pi
8 verbose Linux 4.14.79+
9 verbose argv "/usr/bin/node" "/usr/bin/npm" "cache" "clean"
10 verbose node v8.12.0
11 verbose npm  v6.4.1
12 error As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
12 error
12 error If you're sure you want to delete the entire cache, rerun this command with --force.
13 verbose exit [ 1, true ]
pi@TimePi:~/.npm/_logs $ 

(Yeah, I know.....)

Now - on said RPI - I notice that big-timer has upated to 2.1.1 which it wasn't before.

ARGH!

npm --version

pi@TimePi:~/.node-red $ npm --version
6.4.1
pi@TimePi:~/.node-red $ 

But I did get it from the man npm post above:

(edited part)
man npm:

NPM(1)                                                                                           NPM(1)

NAME
       npm - javascript package manager

SYNOPSIS
         npm <command> [args]

VERSION
       6.4.1

see Updates - node-red-contrib-bigtimer - HELP it was just updated

Thanks Zenofmud.

I do hope it works, but really - from where I am standing - this applies to ALL nodes.

Not just bigtimer.

That is just one of many which need updating.

Somehow in this mess, the dashboard did get updated.

(But on an aside: the ui_LED still doesn't. I see the icon, but I inject true and !true into it and it just stays grey. But on another machine it changes colour.)

As it says, npm cache clean --force

Oh, please....

Ok, but I read

The --force isn't really there.
If it was needed, I say it should be specified.
(No offence UKM)

But I didn't know if it was simply for information gathering or it was needing to be done, so I did what was said.

Shall try with --force and report back.

Oh, "red flag" for me - kind of.

So, npm..... sudo or not?
And from which directory? Is it important?
Home,
Node-red
npm?

the "---force" depends on your version of npm

Good luck with solving your problems

That's fair enough. I get that.

I wasn't having a go at you for posting that.

I didn't understand that it was implied.

I did the command and posted the result.
If it needed the --force at that stage, then I was waiting for confirmation.

This is the latest stuff I see:

pi@TimePi:~/.node-red $ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
pi@TimePi:~/.node-red $ npm install node-red-contrib-cpu
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-cpu@0.0.2
updated 1 package and audited 875 packages in 230.033s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
pi@TimePi:~/.node-red $ sudo systemctl restart nodered
pi@TimePi:~/.node-red $ 

Node-red restarted.

still version 0.0.2

node-red-contrib-cpu
0.0.2

@Trying_to_learn

Looking at the output you provided at the start:

pi@TimePi:~/.node-red $ npm install node-red-contrib-simple-message-queue
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.0.2

Note how it reports it has installed version 0.0.2 at the end there - that is odd given 0.2.2 is the latest available.

With the version of npm you have (ie, pretty much the latest 6.x), it should not be necessary to clean the cache. It should still be checking with the npm repository to check what the latest is.

Please can you try running:

~/.node-red $ npm install node-red-contrib-simple-message-queue@0.2.2

Note the @0.2.2 at the end.

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.

1 Like

I think that a deep breath is required. Maybe take a step back for a second and think about a process that will help you rather than frustrate.

It may help if I explain how I do things.

I don't generally update nodes from within the admin ui. I update from npm and npm has a very convenient couple of commands that lets you update everything with minimal effort.

# Tell me what needs updating
npm outdated
# Update everything that needs updating
npm update

To make it even easier, I make use of the package.json file that lives in the userDir folder (normally ~/.node-red and npm's ability to define and run "scripts". So I can do npm run update and everything is updated.

Below is an example of amended from one of my package.json files. Just note that my start command is for temporarily running node-red manually, I wouldn't normally use that since it is started by systemd on the Pi. Also note that the start command would need adjusting for you anyway since I don't use the standard installation. If you are interested, you can see how and why I do it differently here.

{
  "name": "node-red-nrlive",
  "description": "A Node-RED Project on Pi3",
  "version": "0.19.2",
  "license": "MIT",
  "author": "Julian Knight",
  "repository": {},
  "scripts": {
    "start": "/usr/local/bin/node --max-old-space-size=128 ../node_modules/node-red/red.js --userDir ../.data",
    "restart": "sudo systemctl restart nodered",
    "check": "npm outdated",
    "update": "npm update",
    "logs": "sudo journalctl -u nodered -e -f -n 50",
    "admin": "node-red-admin "
  },
  "dependencies": {
    "node-red-contrib-bigtimer": "^2.0.8",
    "node-red-contrib-blockly": "^1.1.0",
    "node-red-contrib-google-home-notify": "*",
    "node-red-contrib-influxdb": "~0.2.2",
    "node-red-contrib-later": "*",
    "node-red-contrib-moment": "^3.0.1",
    "node-red-contrib-rfxcom": "^2.6.3",
    "node-red-contrib-rive": "~1.1.0",
    "node-red-contrib-smartplug": "*",
    "node-red-contrib-syslog-input": "^1.0.1",
    "node-red-contrib-telegrambot": "^4.8.0",
    "node-red-contrib-throttle": "~0.1.6",
    "node-red-contrib-time-range-switch": "*",
    "node-red-contrib-uibuilder": "^1.0.12",
    "node-red-dashboard": "^2.13.0",
    "node-red-node-darksky": "~0.1.18",
    "node-red-node-openweathermap": "^0.2.1",
    "node-red-node-ping": "0.0.16",
    "node-red-node-rbe": "^0.2.4",
    "node-red-node-serialport": "*",
    "node-red-node-smooth": "*",
    "node-red-node-sqlite": "^0.3.6",
    "node-red-node-weather-underground": "*"
  },
  "engines": {
    "node": "8.*"
  }
}
1 Like

Ok Nick.

I shall try to go through your questions and answer them all to the best of my knowledge:

Correct.

I see that 0.2.2 is available.

I have tried to update it multiple times. It just will not update.

Doing that now. Shall post this reply only to keep information flowing.

Shall post update when it happens.

As I went through previously - not sudo to clean the local cache, sudo to clean the global cache.

This is a recent change to npm which is why the standard command no longer works as it did before but it tells you why and what.

Node.js and npm are still evolving very rapidly so issues like this are expected. Other languages such as PERL or Python are available to people who are averse to change :smile:

You should run npm outdated as the first port of call for issues like this. Later versions of npm have a nasty tendency to enforce semantic versioning and therefore it doesn't like to install what you might think is obvious.

Here is an example:

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 $

Note that the "Wanted" column might not have the same version as the "Latest" and if that is the case, it is because of the dependencies list in your package.json having been set by npm and it preventing the installation of a newer version because it may have "breaking changes". npm forces you to think about that and to amend the package.json file or to deliberately install the newer version using the version override that Nick as already shown.

While I am waiting for the other thing to complete:

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.