【发布时间】:2016-10-20 17:16:14
【问题描述】:
我在我的 centOS 服务器上使用 node v0.10.x,我想更新 node.js,所以关注了一些文章。首先删除当前安装的:
# which node
# cd /usr
# rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1
然后检查 node -v 没有工作,很好。但是使用 yum 并没有安装最新的 Node.js,所以我搜索了一些帖子,发现了这个: https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/
所以我遵循了命令:
# rpm -Uvh https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm
# yum install nodejs -y
这就是问题所在。它打印出许多错误并不断失败。
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-4.el6 will be updated
--> Processing Dependency: nodejs(x86-64) = 0.10.42-4.el6 for package: nodejs-devel-0.10.42-4.el6.x86_64
---> Package nodejs.x86_64 0:5.11.1-1nodesource.el7.centos will be an update
--> Running transaction check
---> Package nodejs-devel.x86_64 0:0.10.42-4.el6 will be updated
---> Package nodejs-devel.x86_64 0:5.11.1-1nodesource.el7.centos will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
nodejs x86_64 5.11.1-1nodesource.el7.centos nodesource 8.7 M
Updating for dependencies:
nodejs-devel x86_64 5.11.1-1nodesource.el7.centos nodesource 7.6 M
Transaction Summary
================================================================================
Upgrade 1 Package (+1 Dependent package)
Total size: 16 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction check error:
file /usr/lib/node_modules/npm/node_modules/semver/package.json from install of nodejs-5.11.1-1nodesource.el7.centos.x86_64 conflicts with file from package nodejs-semver-2.1.0-1.el6.noarch
file /usr/lib/node_modules/npm/node_modules/semver/bin/semver from install of nodejs-5.11.1-1nodesource.el7.centos.x86_64 conflicts with file from package nodejs-semver-2.1.0-1.el6.noarch
file /usr/lib/node_modules/npm/node_modules/semver/semver.js from install of nodejs-5.11.1-1nodesource.el7.centos.x86_64 conflicts with file from package nodejs-semver-2.1.0-1.el6.noarch
... and keeps going on ...
在删除节点之前,我也这样做了:
# npm cache clean -f
# npm install -g n
# n stable
但这根本不起作用,因为总是说版本 0.10.x,甚至下载了最新版本! (我锯过6.2.2什么的)
我认为我的服务器出了点问题,我不知道如何解决这个问题。任何人都可以给一些建议吗?如果可以的话,我想安装最新的 Node.js。
【问题讨论】:
-
你可以尝试删除包nodejs-semver-2.1.0-1.el6.noarch
-
@J.J.Hakala find / -name nodejs-semver-2.1.0-1.el6.noarch 结果为空。那是一个文件吗?
-
@modernator,rpm 包不保存为包,它们被安装到目标(/usr/),然后从缓存中删除。 ...删除:#
yum remove nodejs-semver...