There are many possibilities for this, the most likely from my point of view is that, you have installed Node.js
, that is, you already have it installed, but it is not GLOBAL (in environment variables PATH
or as "shortcut" of the commands).
But it is likely that you have put the command npm
as global, similar to the situation of composer
in Linux:
As these answers in SOen and being Ubuntu, you can try the command:
dpkg-query -L nodejs
I do not have linux to test at the moment
The path is likely to be /usr/bin/node
or /usr/bin/nodejs
, but until then it's just a hypothesis. It could be anything by then, you installed, uninstalled things, it could be simply a bugged version, you could have installed multiple versions of the nodejs and then removed one of them while keeping the other, even while removing the variable PATH
had already been overwritten.
I'm not going to be too hypothetical because it seems like a local error. Still something I need to point out that I do not understand why you are using nodejs-legacy
in Ubuntu, unless you really want some support for older applications.
Now if your Ubuntu is old then yes it should be missing things, I recommend that you follow the steps in:
link