无法在CentOS 7

时间:2017-09-28 01:22:15

标签: node.js linux centos7

我尝试按照nodesource上的说明,以root身份运行这些命令:

curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
yum install -y nodejs

但是当我之后运行node -v时,我发现它只安装了0.10.48。我可以在第二个命令的输出中看到它选择了错误的软件包版本进行下载:

Loaded plugins: fastestmirror, priorities
Setting up Install Process
Loading mirror speeds from cached hostfile
 * epel: mirror.steadfast.net
 * remi: repo1.sea.innoscale.net
 * remi-safe: repo1.sea.innoscale.net
2418 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.48-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================
 Package                                    Arch                                       Version                                            Repository                                Size
=========================================================================================================================================================================================
Installing:
 nodejs                                     x86_64                                     0.10.48-3.el6                                      epel                                     2.1 M

Transaction Summary
=========================================================================================================================================================================================
Install       1 Package(s)

Total download size: 2.1 M
Installed size: 7.1 M
Downloading Packages:
nodejs-0.10.48-3.el6.x86_64.rpm                                                                                                                                   | 2.1 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : nodejs-0.10.48-3.el6.x86_64                                                                                                                                           1/1 
  Verifying  : nodejs-0.10.48-3.el6.x86_64                                                                                                                                           1/1 

Installed:
  nodejs.x86_64 0:0.10.48-3.el6                                                                                                                                                          

Complete!

我尝试使用yum remove -y nodejs npm卸载,然后运行rm -fv /etc/yum.repos.d/nodesource*yum clean allyum update,然后重新安装,但似乎没有任何效果。

为什么它不能解析为v8包?

1 个答案:

答案 0 :(得分:3)

前几天我遇到了同样的问题,我无法通过 nodesource 存储库安装Node版本8。 实际上,rpm存储库中还没有setup_8.x脚本 我最终使用n包来获取Node版本8:

# yum install nodejs  // you need to have npm installed
# npm install -g n
# n stable
# node -v  // v8.4.0