I can\'t use npm install using the command prompt in NodeJS. I\'m getting these errors when running npm install:
module.js:339
On Ubuntu, if you would rather manage Node through the default repositories using apt, it's best to install both nodejs and npm this way.
It's very likely that the version of npm you are using is expecting semver in a specific place that is not aligned with the version of Node JS you have installed. If there is only one version of nodejs and only one version of npm, and they are both installed using the default repositories, this should work perfectly.
Here is my best guidance for getting Node and npm working using the main Ubuntu repositories:
sudo apt-get purge nodejs --auto-remove and sudo apt-get purge npm --auto-removewhereis node: remove all the versions of node, one at a time. Repeat until this command returns a blank after node:.sudo apt-get install nodejsnode --version: should return ... no such file or directorynodejs --version: should return v1x.x.x. This is the version installed by apt. It will probably be less recent that the latest version available on the Node JS website.sudo apt-get install npmnpm --version: it will use the nodejs installed by apt and work correctly.