In many cases, the official libraries are of a lower version.
We may need a higher version of the library when we run some compilations.
There is no way to install using YUM or DNF directly.
Compatibility issues need to be addressed here.
After installing with Snapd, a partition will be created on your system, and authorization errors may occur when different tools or CI tools access NPM.
Therefore, snapd is still not very recommended to install, recommend to use the native way to install.
It’s slower, but it’s still steady.
The solution
Consider using snapd for regular installation.
Official website address is: Install node on CentOS using the Snap Store | Snapcraft
If you want to install NodeJs version 14.17, use the package they provide.
First you need to install the Snapd service, if you don’t have it on your machine, you need to run the following command to install it.
sudo yum install epel-release
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
Copy the code
If you’ve already installed it, just install Snapd.
Snapd is a background process and requires a certain amount of memory. If your machine has too little memory, it may cause the startup process to fail.
The installation process on the server is shown in the preceding figure.
If you encounter an error:
[root@devops-norctx-com www.packloopapis.com]# sudo snap install node --classic
error: cannot communicate with server: Post "http://localhost/v2/snaps/node": dial unix /run/snapd.socket: connect: no such file or directory
Copy the code
This is because snapd is not running and you need to start it manually.
To start, run the following command:
systemctl restart snapd
Copy the code
Finally run the command:
sudo snap install node --classic
Copy the code
Install NodeJS.
After the installation is complete, use the command node –version to view the current version.
Make sure you have the version you need installed on your machine.
www.ossez.com/t/centos-sn…