2016-06-19 172 views
0

我在centOS服务器上使用节点v0.10.x,我想更新node.js,所以后面跟着一些文章。先删除当前安装的:centOS无法通过yum安装nodejs

# which node 
# cd /usr 
# rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1 

然后检查节点-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.

+1

你可以尝试删除包*的NodeJS-semver-2.1.0-1.el6.noarch * –

+0

@JJHakala **查找/ -name的NodeJS-semver-2.1.0-1.el6.noarch * *结果为空。是一个文件? – modernator

+1

@modernator,rpm包不保存为包,它们安装到目标(/ usr /),然后从缓存中删除。 ...删除:#'yum删除nodejs-semver' ... –

回答

2

从EPEL库

yum update 
yum install epel-release 
yum install nodejs 
node --version 

安装节点可访问NPM来管理他们的节点包。

yum install npm 
+3

** yum更新**失败,同样的错误。 – modernator