Skip to main content

Working on a new CentOS 7 server, Node wasn't installed.  You can quickly this through using the prompt node -v

node not found

In Plesk, the extension had been installed, however this doesn't mean correctly.  So I needed to install Node and npm on the CentOS 7 server.


Installing nodejs and npm

To get the curl for v14 go to and you'll see that the most suited is 

# As root
curl -sL | bash -

# No root privileges 
curl -sL | sudo bash -

The curl command will first use the curl tool to download the “setup_14.x” script and then execute this script using bash.  Output from the script will look like:

## Installing the NodeSource Node.js 14.x repo...

## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null ''

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.52Jxe2LxTP' ''

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.52Jxe2LxTP'

## Cleaning up...

+ rm -f '/tmp/tmp.52Jxe2LxTP'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 14.x and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

As the comment in the third last line notes above, to install Node.js 14.x and npm execute the command 

sudo yum install -y nodejs

Unlike when I attempted to run Nodejs 12.x some time ago and received errors, this time the experience was seemless

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                         | 5.1 kB  00:00:00     
 * base:
 * epel:
 * extras:
 * updates: 
nodesource/x86_64/primary_db                                                 |  35 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:14.15.4-1nodesource will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package           Arch              Version                            Repository             Size
 nodejs            x86_64            2:14.15.4-1nodesource              nodesource             32 M

Transaction Summary
Install  1 Package

Total download size: 32 M
Installed size: 91 M
Downloading packages:
nodejs-14.15.4-1nodesource.x86_64.rpm                                        |  32 MB  00:00:05   
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : 2:nodejs-14.15.4-1nodesource.x86_64                                              1/1 
  Verifying  : 2:nodejs-14.15.4-1nodesource.x86_64                                              1/1 

  nodejs.x86_64 2:14.15.4-1nodesource                                                               


A quick check to see that Nodejs has been installed using the version prompt node -v


and for the npm version npm -v