npm command not found on CentOS 8 Server


npm command not found

I got the error npm command not found on my CentOS 8 server. Follow the below steps to install npm command on CentOS 8 / RHEL 8 server.

1. Log into your CentOS 8 server via SSH as root

2. Install npm package on the server using yum

3. Enter ‘y’ if yum ask for confirmation while installing npm.

4. Verify the installation by checking npm version.


npm command not found

npm command not found


First you must run the command ‘yum list available | grep npm’ to check the available version of npm.

[root@centos /]# yum list available | grep npm
npm.x86_64 1:6.14.11- AppStream

Run the command ‘yum install npm’ to install the package.

[root@centos /]# yum install npm
Arch Version Repo Size
npm x86_64 1:6.14.11- AppStream 3.7 M
Installing dependencies:
nodejs x86_64 1:10.24.0-1.module_el8.3.0+717+fa496f1d AppStream 8.8 M
Installing weak dependencies:
x86_64 1:10.24.0-1.module_el8.3.0+717+fa496f1d AppStream 7.3 M
Enabling module streams:
nodejs 10

Transaction Summary
Install 3 Packages

Total download size: 20 M
Installed size: 71 M
Is this ok [y/N]: y



npm command not found - how to install npm command

npm command not found – how to install npm command

Npm is installed on your server. You can verify the installation by running the command ‘npm version’

[root@centos /]# npm version
{ npm: ‘6.14.11’,
ares: ‘1.15.0’,
brotli: ‘1.0.7’,
cldr: ‘35.1’,
http_parser: ‘2.9.4’,
icu: ‘64.2’,
modules: ’64’,
napi: ‘7’,
nghttp2: ‘1.41.0’,
node: ‘10.24.0’,
openssl: ‘1.1.1g’,
tz: ‘2019c’,
unicode: ‘12.1’,
uv: ‘1.34.2’,
v8: ‘’,
zlib: ‘1.2.11’ }

Install npm rpm package from CentOS 8 website:

cd /usr/local/src/


rpm -Uvh npm-7.21.0-