How to Install Node.js on CentOS Stream 9
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
Installing Development Tools
It's necessary for compiling and installing native add-ons from the npm registry,
dnf groupinstall 'Development Tools'
Installing Node.js
Run the following command list the modules that provide the NodeJS package,
sudo yum -y install nodejs
Check the version Once the installation is complete,
node --version
OR you can Install via NVM as shown below.
Install Specific Node.js Version using NVM
You can use any of the codes below:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
Then
source ~/.bash_profile
nvm list-remote
nvm install 16.13.0
node -v
Uninstalling Node.js
If you wish to uninstall Node.js and npm packages, you can run the command,
sudo rm -rf /var/cache/yum
sudo yum remove -y nodejs
sudo rm /etc/yum.repos.d/nodesource*
sudo yum clean all
Now you have successfully installed Nodejs on CentOS Stream 9.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS