简体   繁体   中英

how to install nodejs8.x on centos7? i got error

I have to install nodejs8 on centos 7. However, the installation failed. I'm attaching the code I excuted and the execution result below, so please help me

<> ===================================================

[root@localhost ~]# sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

[root@localhost ~]# sudo yum install gcc-c++ make

[root@localhost ~]# sudo yum install -y nodejs

Total download size: 32 M Installed size: 92 M Downloading packages: No Presto metadata available for nodesource nodejs-14.18.3-1nodesource.x86 FAILED
https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodejs-14.18.3-1nodesource.x86_64.rpm : [Errno 14] HTTPS Error 404 - Not Found ] 0.0 B/s | 0 B --:--:-- `ETA Trying other mirror. Error downloading packages: 2:nodejs-14.18.3-1nodesource.x86_64: [Errno 256] No more mirrors to try. ===================================================+++++++++++++++++++++++++

Here are two ways to try:

NOTE - Tested on CentOS 7.9.

  1. Use the setup program (this is what you did, but it doesn't look like you installed the Extra Packages for Enterprise Linux (EPEL)):
sudo yum install epel-release
sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum install gcc-c++ make
sudo yum install nodejs
  1. If that does not work, download the tarball and install manually:
wget https://nodejs.org/dist/latest-v8.x/node-v8.17.0-linux-x64.tar.gz -P ~/Downloads
cd ~/Downloads
sudo tar -C /usr/local --strip-components 1 -xzf node*.tar.gz

Afterwards, check that nodejs was installed:

$ node -v
v8.17.0

$ npm -v
6.13.4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM