Upgrade problem: Node-RED is not yet fully installed

Goinf around the install loop made no difference

pi@plinth:~ $ npm root -g
/usr/lib/node_modules

How does this help?

well yours are in /usr/... so rather than remove /usr/local/... remove /usr/bin/node /usr/bin/npm and /usr/lib/node_modules/npm ...
but we are in wild west territory now... - should not have to be here.

I feel your pain :frowning:
Remote diagnosing situations that you can't reproduce or understand how they occurred in the first place is truly maddening!

It is working again

JFI - still getting this after the update

pi@plinth:~ $ npm root -g
/usr/lib/node_modules

That's okey, have a look here:
https://docs.npmjs.com/cli/root

JMI - I've got the new sd card up and running on another PiZero - plain Jun2018 full raspbian - no apt updates/upgrades

pi@27Jun18_19Sep18:~ $ npm root -g
/usr/lib/node_modules

Sorry, I don't catch what you mean!

I was just showing that I got the same info on a brand new install

I've got another PiZero that I'm going to attempt to upgrade

Before I start here is it current version levels

pi@kitchenpir:~ $ node -v
v8.11.4
pi@kitchenpir:~ $ npm -v
5.6.0
pi@kitchenpir:~ $ 

and Node-RED 0.19.2

This one failed as well - just going to do this and re-try the upgrade

sudo rm -rf /usr/lib/node_modules
sudo rm -rf /usr/bin/node

well.....it started to look like it had worked so I posted that it had......
and then when I re-looked and found that it had failed :frowning:

pi@kitchenpir:~/.node-red $ node-red
19 Sep 21:40:29 - [info] 

Welcome to Node-RED
===================

19 Sep 21:40:29 - [info] Node-RED version: v0.19.4
19 Sep 21:40:29 - [info] Node.js  version: v8.12.0
19 Sep 21:40:29 - [info] Linux 4.9.59+ arm LE
19 Sep 21:40:32 - [info] Loading palette nodes
19 Sep 21:40:50 - [info] Dashboard version 2.8.2 started at /ui
19 Sep 21:40:52 - [info] Settings file  : /home/pi/.node-red/settings.js
19 Sep 21:40:52 - [info] Context store  : 'default' [module=localfilesystem]
19 Sep 21:40:53 - [error] Failed to start server:
19 Sep 21:40:53 - [error] Error: Error loading context store: SyntaxError: Unexpected token u in JSON at position 0
    at /usr/lib/node_modules/node-red/red/runtime/nodes/context/index.js:175:15
    at <anonymous>

but I'm wondering if this is just a separate issue?

What happens if you start node-red this way:

node-red-start

I renamed my /home/pi/.node-red/context folder to something else and this time it all started up fine

(I think this last error caused by me using this pi to temporarly run the flows on my 1st broken Pi and it must have just got a bit confused so I think it can safely be ignored as having anything to do with the main upgrade issue)

So I'm wondering if the update script needs to add in

sudo rm -rf /usr/lib/node_modules
sudo rm -rf /usr/bin/node

as a workaround for this issue?

I just updated a Pi3B+ to 0.19.4 with the script with no errors!!

can you remember what version of node and npm it was on beforehand?

if not - when did you last update it?

Already did that fix (as long as you are using the bash script version)

1 Like

Can't tell you what version of node or npm but it was less than a week since I installed. I have only one flow and projects are not enabled.

sudo rm -rf /usr/local/lib/node_modules/node-red* /usr/local/lib/node_modules/npm /usr/local/bin/node-red* /usr/local/bin/node /usr/local/bin/npm 2&gt;&amp;1 | sudo tee -a /var/log/nodered-install.log &gt;&gt;/dev/null

I may be wrong but I read this change in the github repo as just cleaning up stuff in /usr/local whereas I found I needed to clean up /usr/lib stuff with

(Might not need both of those but those are the ones I ran )

OK. But wiping the whole node_modules directory would potentially wipe any non node-red stuff folk have installed. So may not be a popular thing to do..