NPM does not support Node.js v10.15.2

Hi,
after installing node-red and npm on my raspi I get an NPM support error.
Currently I am running NPM 5.8.0 and Node 10.15.2
If I try to upgrade to a newer NPM using

pi@raspberrypi:~ $ sudo npm install npm@latest -g
npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! request to https://registry.npmjs.org/npm failed, reason: unable to get local issuer certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-02T09_20_27_206Z-debug.log
pi@raspberrypi:~ $

I get an error I do not understand ... seems to be caused by an certificate issue with https://nodejs.org

Any idea how I can fix this ?
BR
Go

Hi, how did you install node given your other post saying the install script didn't work?

manually

apt-get install nodered

Have you tried googling for the error?

yes and I found several solution, the easiest way aorund it would be to turn of strict-ssl, but thats not the way I'd like to solve it
unfortunately all other options did not work as expected

what version of npm do you end up with installed after doing that ?
I seem to recall seeing that warning once upon a time but it ended up installed (and working).

You seem to have assumed that the version of node.js in the default libraries for your version of Linux are up-to-date and that is often not the case. Did you follow the recommended installation from the node.js site? That will install the correct version of npm to match the current version of node.js.

you are right - I was expecting too much from a linux based system
but the issue is solved meanwhile thanks to Biskis:

Actually, I wouldn't follow those instructions. As I said, the best place to go is the node.js website. Really you want to use a distribution library so that you can keep node.js up-to-date using sudo apt-get update && sudo apt-get upgrade like everything else. The node website directs you to here for Debian based systems including ARM:

That tells you to do:

sudo curl -sL https://deb.nodesource.com/setup_12.x | bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential

Job done.

(which indeed is what we do inside our script - when it works :wink:

2 Likes