在Centos 6.8上安装Node

mil*_*jay 4 centos node.js

我正在尝试使用以下指令在Centos 6.8上安装nodejs:

http://tecadmin.net/install-latest-nodejs-and-npm-on-centos/#

当我跑步 yum install nodejs

但是我收到以下错误

Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:5.12.0-1nodesource.el7.centos will be installed
--> Processing Dependency: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) for package: nodejs-5.12.0-1nodesource.el7.centos.x86_64
--> Processing Dependency: libc.so.6(GLIBC_2.15)(64bit) for package: nodejs-5.12.0-1nodesource.el7.centos.x86_64
--> Finished Dependency Resolution
Error: Package: nodejs-5.12.0-1nodesource.el7.centos.x86_64 (nodesource)
       Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Error: Package: nodejs-5.12.0-1nodesource.el7.centos.x86_64 (nodesource)
       Requires: libc.so.6(GLIBC_2.15)(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Run Code Online (Sandbox Code Playgroud)

Mah*_*bar 7

安装前试一下:

yum clean all
rm -rf /var/cache/yum/*
yum update
Run Code Online (Sandbox Code Playgroud)

我的问题出在缓存包中...


Cla*_*vic 5

也许在使用 yum 安装 nodejs 之前,您需要安装 gcc-c++ 和 make。

尝试这个:

$ yum install -y gcc-c++ make

$ curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -

进而:

$ yum install nodejs

并使用以下方法确认:

$ node -v

http://tecadmin.net/install-latest-nodejs-and-npm-on-centos/


小智 5

在centos 7上安装Node.js(最新版本)的最佳方法:(确保您是sudo用户)

  1. 打开终端并输入: cd ~
  2. 然后键入:(wget http://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz必须检查最新版本,相应地更改版本名称)
  3. 然后:(sudo tar --strip-components 1 -xzvf node-v10.15.1-linux-x64.tar.gz -C /usr/local 必须检查最新版本,相应地更改版本名称)
  4. 使用以下方法进行验证: node --version

  • 该问题特别提到“Centos 6.8”,但您的回答针对的是 Centos 7。 (2认同)