I am having centos 7 and already installed npm on my machine but when i try npm command its showing me error as
npm: command not found
[vinit@NL577 ~]$ sudo yum install npm
[sudo] password for vinit:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 3.5 kB 00:00:00
* base: repos.del.extreme-ix.org
* epel: repos.del.extreme-ix.org
* extras: repos.del.extreme-ix.org
* updates: repos.del.extreme-ix.org
adobe-linux-x86_64 | 3.0 kB 00:00:00
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
google-chrome | 1.3 kB 00:00:00
sublime-text | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
Package 1:npm-3.10.10-1.6.16.0.1.el7.x86_64 already installed and latest version
Nothing to do
[vinit@NL577 ~]$ npm
bash: npm: command not found...
Update the system and install necessary packages
yum install curl sudo
Install Node.js and npm from the NodeSource repository
We will install Node.js v6 LTS and npm from the NodeSource repository which depends on the EPEL repository being available.
To enable the EPEL repository on your CentOS 7 VPS, issue the following command:
sudo yum install epel-release
Once the EPEL repository is enabled run the following command to add the Node.js v6 LTS repository:
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
Once the NodeSource repository is enabled we can proceed with the Node.js v6 LTS and npm installation:
sudo yum install nodejs
If it doesn't work, try to uninstall NodeJs and repeat all actions.
sudo rm -rf /var/cache/yum
sudo yum remove -y nodejs
sudo rm /etc/yum.repos.d/nodesource*
sudo yum clean all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With