couldn't install npm on ubuntu

This looks like you probably installed the chris-lea node.js ppa which is fine. However, you don't install npm from that ppa as it breaks the way debian packages work. Instead, just install nodejs. Once that's installed, run npm -v you should see it's now installed. If you didn't use the chris-lea ppa update your question on what webpage you Googled to find out how to install nodejs on Ubuntu.


Try installing NodeJs like this:

sudo apt-get install nodejs

Since NodeJs installs node and npm


Apt doesn't handle dependancy conflicts well, use snap or aptitude;

sudo aptitude install npm

I had to press "no" to the first solution it proposed, which did not include installing npm (that must be a bug in aptitude) then the second solution I pressed yes to hTHen check npm was installed:

npm --version