npm does not support Node.js v10.19.0 You should probably upgrade to a newer version of node as we can't make any promises that npm will work with this version. You can find the latest version at https://nodejs.org/


3 Answers 3


Short Answer

The simplest is to update to Node.js v14:

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

If you having problems installing try sudo apt-get purge nodejs, see details.

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:

| NodeJS  | `npm --version` |
| Node 20 | 9.0+            |
| Node 18 | 8.0+            |
| Node 16 | 6.0+            |
| Node 14 | 4.14+, <9.0     |
| Node 12 | 4.12+, <8.0     |
| Node 10 | 4.9+ , <6.0     |

I skipped the uneven numbers, because they don't have a long-term-support.

If you would like to update to e.g. Node.js 18, edit the number from the code above:

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
if [ -f "/etc/debian_version" ]; then
 sudo apt-get install -y nodejs

This answer is based on (How to update node.js) as well on (compatible node.js and npm-Versions)

  • For those having an ERROR E: The repository 'http://ppa.launchpad.net/bluetooth/bluez/ubuntu focal Release' does not have a Release file., just run sudo add-apt-repository --remove ppa:bluetooth/bluez and you will be able to run the above commands Commented Apr 25, 2022 at 3:10
  • 1
    I'd like to combine this answer with That Answer on the Stack Overflow. Both of them offers complete solution npm running issues
    – SaidbakR
    Commented Apr 30, 2022 at 0:20

If you have nvm you can try re-installing node versions. Make sure you switch to the version of node for which your npm works first. For example switch to node 8 and then re-install other versions.

nvm use 8
nvm uninstall 10
nvm uninstall  12
nvm install 10
nvm install 12
nvm use 10
nvm alias default 10   
nvm uninstall 8

Source: maxbettercloud on https://github.com/nodejs/help/issues/3644#issuecomment-999170850

  • And to list all available versions do nvm ls-remote.
    – dr0i
    Commented Feb 1, 2023 at 11:13

Update 2023:

node.js changed the installation: https://github.com/nodesource/distributions#installation-instructions

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -y

PS: You can change the Version by choosing one of the following: NODE_MAJOR=16;NODE_MAJOR=18;NODE_MAJOR=20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .