This blog I want upgrade Node.js to current statble version on Centos. Here is step by step.
Check existing node.js version on machine
Following step with command line
clear cache
sudo rm -rf /var/cache/yum
sudo yum remove -y nodejs
and also remove node.js directory
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/include/node*
sudo rm -rf /usr/local/bin/node*
Install latest version
I need install stable of Node 16.x LTS.
Add NodeSource yum repository
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
and the output like here
## Run `sudo yum install -y nodejs` to install Node.js 16.x and npm.
## You may run dnf if yum is not available:
sudo dnf install -y nodejs
## 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 https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
Install package
sudo yum install -y nodejs
Check node.js and npm version
Cheer!!!
Top comments (0)