Major Issue updating Node and Node Red

Since yesterday, two of us in different countries have been trying to update Node-Red without success. Today I took a known working Node Red installation on an RPI3 B+ (Node 6) and tried to install your upgrade script https://nodered.org/docs/getting-started/upgrading

I've used this upgrade script after my own install script many times in the past without issue.
This is what I'm getting now. Will not install node.js after deleting the original. Any ideas? after several attempts (usind decent SDs - Sandisk Ultra 16GB) I'm no further forward.

pi@pi3b:~:15:24[0]> bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

This script will remove versions of Node.js prior to version 6.x, and Node-RED and
if necessary replace them with Node.js 8.x LTS (carbon) and the latest Node-RED from Npm.

It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.

It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.

To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.

Are you really sure you want to do this ? [y/N] ? y
Running Node-RED update for user pi at /home/pi

This can take 20-30 minutes on the slower Pi versions - please wait.

Stop Node-RED :heavy_check_mark:
Remove old version of Node-RED :heavy_check_mark:
Remove old version of Node.js -
Update Node.js LTS ✘ Failed to install Node.js - Exit
Clean npm cache
Install Node-RED core
Move global nodes to local
Install extra Pi nodes
Npm rebuild existing nodes
Add menu shortcut
Update systemd script

Any errors will be logged to /var/log/nodered-install.log

pi@pi3b:~:16:03[2]>

Have you looked in the log file it points you at for any further information on the failure?

No, Nick, but I'm using the rpi sd backup, I'll try again and send the log info this time.

1 Like

tried to send the log but it says Im a new user

https://www.dropbox.com/s/ez7i77jycvyzafk/nrlog.txt?dl=0 this is dropbox link to today's part of the log file

So what is in
/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator
and what are the permissions / ownership?

dpkg: warning: unable to delete old directory '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator': Directory not empty

I'm back to the pre-ruined version... a load of .py files...and one .pyc file - permissions 644 and 755... some owned by root. I can only imagine these are demo files for Python, certainly not my files.

To explain, my well l tested script installs node red, mqtt, sqlite, grafana, apache etc and has been running on all PI boards except the very old ones... and a number of other boards, with Debian Ubuntu etc... no problems - I've been at this for ages. I was out of action around XMAS through March and in May I put the script with the usual full Raspbian onto RPi2 and 3 boards as usual, no issues other than some nodes needing root access hence my using the NR upgrade script which I've again done for some time, then out of the blue, neither Mr Shark nor I can upgrade to Node 8 and I can't get that upgrade script to work. Different machines in different countries, similar results.

I've just upgraded two RPi(s) - one worked perfectly, the other one tripped out with the message...
Update Node.js LTS ✘ Failed to install Node.js - Exit
I'm now trying to sort out getting Node-RED reinstalled on the RPi.

I'm watching this thread for a solution. I was about to upgrade a Pi that I don't want to break to test the fix posted by the author of node-red-contrib-ftp-server to allow it to use node 8.x

This thread has possibly saved me a serious headache and dropped me back to "if it ain't broke, don't fix it!" mode.

Anyone any ideas WHY this is happening? Node repository??

@scargill that log doesn't actually show any failures - I think the 'unable to delete' messages are just warnings - and the log suggests things have continued beyond them.

But the log does end a bit abruptly:

Setting up nodejs (8.11.1~dfsg-2~bpo9+1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...

So no clues there. At this point, I think we need @dceejay to take a look, but he is currently on vacation until next week.

Sorry if already mentioned. Did you try running the script a second time ( to see if it recovers the situation ) ?

If that fails then delete
/etc/apt/sources.list.d/nodesource.list
And then re-run
(The issue is that you are Nide 6, and pi have now released node8 and it starts to install that and while it should work... Obviously it isn't. Deleting the file above and rerunning will make my script think its not installed and will update to 8 "our" way.)

confirm... i had lot of issues in latest days... tried using both ubuntu 16.04 and debian 9, both x86-64 in vmware virtual machine... i had lots of 404 errors installing packages, using various mirrors (IT, DE, FR, US)... then issues with node-red not starting up, and the like... in some cases, the 404 errors reported the problematic DEB file... well, copying the url and pasting in browser downloaded the package, so really don't know what's happening...

I got up early this morning and - armed with backups, after 2 days of utter frustration, I took the plunge and simply deleted the nodesource file as per Dave's suggestion and then ran his script on a month old installation which included our "the script" and some simple Node-Red code. Within 5 minutes I was further on than I'd been in 2 days of not just trying Dave's script on an existing setup but also ours on a clean setup. Now, Node and Node-Red core went in without apparent issue. Then the long wait for moving nodes to local. Then done showing no errors at the console. And at first sight.. it is UP.

Thanks Nick – in fact Dave responded and I’m up at 6:30am here in Spain working on it… 5 mins through NR core install, now sitting in the next part for 10 mins…. Waiting to see it his script completes.. not a lot visibly happening… done, no reported errors, all green ticks… started Node-Red, worked. Rebooted, started NR automatically as before.

Simple serial test (with in and out NOT shorted together) didn’t show any obvious errors…

An hour later, it all looks sorted. nodesource.list has been restored automatically and all seems well, other than the pesky rpI3 serial port but I assume that is an entirely different matter. No errors but it is now called ttyS0 - needs permission - and enabling in config.txt and then STILL does nothing. Doesn't seem to error just does not echo changes even with pins 8 and 10 shorted. Something for another thread.

Here's a snip of the error message I get after running the 'update' script a couple of times.

Starting as a systemd service.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
Started Node-RED graphical event wiring tool.
nodered.service: Main process exited, code=exited, status=127/n/a
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.

example: just run Peter's script, it was in early stages, so just doing "apt-get install" of some packages on a freshly installed debian 9 in virtual machine, of course after an "apt-get update" command...

[CUT]
Scaricamento di:7 http://ftp.it.debian.org/debian stretch/main amd64 cmake amd64 3.7.2-1 [3.038 kB]
Err:8 http://security.debian.org/debian-security stretch/updates/main amd64 git-man all 1:2.11.0-3+deb9u3
  400  Bad Request [IP: 151.101.36.204 80]
[CUT]
  Recuperati 109 MB in 22s (4.888 kB/s)
E: Impossibile recuperare http://security.debian.org/debian-security/pool/updates/main/g/git/git-man_2.11.0-3+deb9u3_all.deb  400  Bad Request [IP: 151.101.36.204 80]
E: Impossibile scaricare alcuni pacchetti. Potrebbe essere utile eseguire "apt-get update" o provare l'opzione "--fix-missing".
[CUT]

but if you copy that last url in browser, it downloads without issues, same if you use wget to download it from the same vm where script was running... and this happens for a lot of packages in different points every time you try to run it, so it happens even in node-red and other installs... same problems are present if using an ubuntu 16.04 vm...