from https://techviewleo.com/install-node-js-on-centos-linux/
-
Node.js packages are provided through the NodeSource Node.js Binary Distributions via .rpm. Add the repository to the system using the commands below:
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
-
Tencent OpenCloudOS is not in the supported list
You don't appear to be running a supported version of Enterprise Linux "opencloudos"
curl -fsSL https://rpm.nodesource.com/setup_16.x -o setup_16.sh vi setup_16.sh
change line
if [[ $DISTRO_PKG =~ ^(redhat|centos|almalinux|rocky|cloudlinux|mageia|sl)- ]]; then
to
if [[ $DISTRO_PKG =~ ^(redhat|centos|almalinux|rocky|cloudlinux|opencloudos|mageia|sl)- ]]; then
run the shell
sh setup_16.sh
You may need to clear the cache of pre-installed incorrect versions
yum clean all
-
Once the repository has been configured on your CentOS server you can proceed to install Node.js 16 on CentOS 8 | CentOS 7:
sudo yum install -y nodejs
-
If you need development tools to build native addons:
sudo yum install gcc-c++ make