Home >Web Front-end >Front-end Q&A >yum cannot find nodejs
When using Linux systems such as CentOS or Ubuntu, we inevitably need to use package management tools such as yum or apt-get to install the required software packages. When using yum to install a software package, sometimes an error message "cannot find the software package" will appear. This article will focus on how to solve the problem that yum cannot find the nodejs package in this case, and provide several solutions.
When yum cannot find the nodejs package, the first thing we need to check is whether the yum source is correctly configured. You can run the following command to update the yum source information:
sudo yum clean all sudo yum update
Then, we try to reinstall: "nodejs" package:
sudo yum install nodejs
If yum still prompts that it cannot be found, you can try the following solution.
Epel Yum source is the abbreviation of Extra Packages for Enterprise Linux (RHEL). It provides some software packages for enterprise-level Linux systems. This includes nodejs. You can try to use the following command to install the Epel Yum source:
sudo yum install epel-release
After installing the Epel Yum source, run the following command again to install nodejs:
sudo yum install nodejs
If the "package not found" error message still appears, You can try the next option.
Run the following command to get the nodejs installation script:
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
Then, use yum again to install nodejs:
sudo yum install nodejs
If the above three solutions do not work, we can manually download the nodejs installation package for installation.
First, we need to download the corresponding nodejs software package according to the system architecture. For example, if the current system is x64 architecture, you can visit the following link to download nodejs:
https://rpm.nodesource.com/pub_14.x/el/7/x86_64/nodejs-14.15.1-1nodesource.el7.x86_64.rpm
After downloading, you can run the following command to install:
sudo yum install /path/to/nodejs-14.15.1-1nodesource.el7.x86_64.rpm
If there is no error prompt after executing the above installation command , it means nodejs is successfully installed.
Summary
When yum cannot find the nodejs package, we can try to update the yum source information, use the Epel Yum source, install from NodeSource, manually download the installation package, etc. Either of these may resolve the issue, depending on the current system environment and circumstances.
The above is the detailed content of yum cannot find nodejs. For more information, please follow other related articles on the PHP Chinese website!