My problem, i can’t install my packages or upgrade npm via "npm install -g npm@latest" – because of this problem.
- ERROR: npm is known not to run on Node.js v10.19.0
You’ll need to upgrade to a newer Node.js version in order to use this
version of npm. You can find the latest version at https://nodejs.org/
I’ve installed newest version of node.
currently node -v shows v16.15.1
but npm still thinking i’m using an old one.
How to update my npm’s node version?.
P.S. My current OS is Ubuntu 20.08
3
Answers
npm cache clean -f
and thennpm install -g npm@latest
Duplicate of: https://askubuntu.com/a/1382566/391310
Short Answer
The simplest is to update to Node.js v12:
Long Answer
You could update to newer Node.js-versions, see:
https://github.com/nodesource/distributions#readme
however according to a comment on github, jumping to the newest version, might lead to breaking changes. (I don’t notice any.)
Thanks to a comment from @SaidbakR below : To see which version is compatible check the following table:
I skipped the uneven numbers, because they don’t have a long-term-support. Node 18 is as of May 2022 in a prerelease state.
If you would like to update to e.g. Node.js 16, edit the number from the code above:
This answer is based on (How to update node.js) as well on (compatible node.js and npm-Versions)
because npm is installed via shim. You must do this steps