Reputation: 116
Recently I was trying to add a new dependency to my project using npm, but when I ran npm install
, nothing happened. It just returned me straight back to the command line. I tried a few more npm commands like npm -v
, but none of them did anything and all of them returned me back to the command line. I tried using sudo apt --reinstall install npm
, didn't fix it. I tried to remove and install using sudo apt --purge remove npm
, still didn't fix. I also tried uninstalling nodejs as well, but none of these things did anything to fix the issue. All npm commands just return back to the command line and do nothing, not even "command not found." One strange thing I did notice happening was that even when I restarted after uninstalling node and npm, node -v
still gave the version of node I had installed. Does anyone have any idea what's going on here? (Operating system is Ubuntu 18.04)
Upvotes: 0
Views: 1587
Reputation: 116
The issue stems from the fact that my active node version was installed using n
and not sudo apt install
, and for whatever reason, they are in separate locations and don't like to cooperate. This led to me messing around with the PATH variable, and eventually figuring how to get the node and npm from n
to uninstall. Then I just reinstalled using n
and everything worked fine.
Upvotes: 1