Most of my machines I use a lot are up to date with NR 3.x.
Lately I've dug up some older machines and they have NR 1.8x on them. (RasPies too.)
And the machine is running .... Jessie I believe.
So node.js is OLD too.
What's happening is I am exporting things from the main machines to them and getting errors. Of course.
So I try to update but am told the node.js is no longer supported (or something like that) and it would be nice to update NR to 3.x
Yes, I get that this means a bit of work on my part.
An update of the O/S would be even better.
So my question is - I hope as briefly as possible:
Can I update to a later node.js than what is used by NR 1.x WITHOUT updating the O/S?
I get it that if that can't be done I really only have 2 choices. Leave alone or update the whole thing.
Just thought I would ask to establish the first part.
Yes, you can. I don't think you'll get problems on Jesse. Just make sure all the OS libraries are up-to-date. Then either use Dave's update script or use a suitable library listed on the Node.js website.
When you've updated node.js, don't forget to do an npm rebuild on both global and your userDir folder.
pi@PortaPi:~/.node-red $ node-red
/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/empty/index.js:13
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/node_modules/node-red/node_modules/fs-extra/lib/index.js:8:6)
pi@PortaPi:~/.node-red $
Searching and looking for how to update the nodejs part:
pi@PortaPi:~/.node-red $ sudo npm install node@16
> node@16.20.1 preinstall /home/pi/.node-red/node_modules/node
> node installArchSpecificPackage
npm ERR! code EACCES
npm ERR! syscall scandir
npm ERR! path /root/.npm/_logs
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:1000 "/root/.npm"
glob error { Error: EACCES: permission denied, scandir '/root/.npm/_logs'
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs' }
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /root/.npm/_cacache/index-v5/dd/7f/965535007b5e6377646cd614059b54639208968a34ca0a0168dfef442a3d
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:1000 "/root/.npm"
module.js:550
throw err;
^
Error: Cannot find module 'node-linux-arm/package.json'
at Function.Module._resolveFilename (module.js:548:15)
at Function.resolve (internal/module.js:18:19)
at ChildProcess.<anonymous> (/home/pi/.node-red/node_modules/node-bin-setup/index.js:19:27)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@16.20.1 preinstall: `node installArchSpecificPackage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node@16.20.1 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-08-14T07_19_25_885Z-debug.log
pi@PortaPi:~/.node-red $
So I am really confused.
Oh - P.S.
The log file - mentioned at the end - doesn't exist.
pi@PortaPi:~/.node-red $ sudo apt update && sudo apt full-upgrade
Hit:1 https://deb.nodesource.com/node_8.x stretch InRelease
Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
Hit:3 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Ign:4 https://q4os.org/qextrepo q4os-rpi-firefox-cn InRelease
Err:5 https://q4os.org/qextrepo q4os-rpi-firefox-cn Release
404 Not Found
Reading package lists... Done
E: The repository 'http://q4os.org/qextrepo q4os-rpi-firefox-cn Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
pi@PortaPi:~/.node-red $
What you should see is that it has errored out and not completed, therefore nodejs cannot be updated via apt.
Look in /etc/apt/sources.list and delete the relevant line(s) if they are there (or comment them out). If not then look for a file in /etc/apt/sources.list.d/ that provides that repository and delete it (or comment out the contents). Then make sure the update && full-upgrade works, then run the script again.