Cing Sian Dal

Nov 22, 2021

1 min read

npm WARN npm npm does not support Node.js on Ubuntu

Normally you have tried:

sudo apt remove nodejs 
sudo apt remove npm
sudo apt install nodejs
sudo apt install npm

It didn’t work. You have also tried:

npm install npm@latest -g

It prompted the error again. You have also tried:

curl https://www.npmjs.com/install.sh | sudo sh

It didn’t work.

Do this:

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

It will work.

Read more at this https://github.com/nodesource/distributions/blob/master/README.md#deb