简体   繁体   English

如何在centos7上安装nodejs8.x? 我有错误

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

I have to install nodejs8 on centos 7. However, the installation failed.我必须在 centos 7 上安装 nodejs8。但是,安装失败。 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 | [root@localhost ~]# sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -须藤 bash -

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

[root@localhost ~]# sudo yum install -y nodejs [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总下载大小:32 M 安装大小:92 M 下载包:没有可用于 nodesource nodejs-14.18.3-1nodesource.x86 的 Presto 元数据
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 | https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodejs-14.18.3-1nodesource.x86_64.rpm :[Errno 14] HTTPS 错误 04/未找到] 0 B --:--:-- `ETA Trying other mirror. 0 B --:--:-- `ETA 正在尝试其他镜像。 Error downloading packages: 2:nodejs-14.18.3-1nodesource.x86_64: [Errno 256] No more mirrors to try.下载包时出错:2:nodejs-14.18.3-1nodesource.x86_64: [Errno 256] 没有更多镜像可以尝试。 ===================================================+++++++++++++++++++++++++ ==================================================== =++++++++++++++++++++++++++++++

Here are two ways to try:这里有两种方法可以尝试:

NOTE - Tested on CentOS 7.9.注意- 在 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)):使用安装程序(这是您所做的,但看起来您没有安装 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:如果这不起作用,请下载 tarball 并手动安装:
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:之后,检查是否安装了 nodejs:

$ node -v
v8.17.0

$ npm -v
6.13.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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