我在更新服务器操作系统时遇到问题。这是我运行时遇到的错误列表sudo yum update
:
file /usr/lib/node_modules/npm/node_modules/which/package.json from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-which-1.0.5-8.el6.noarch
file /usr/lib/node_modules/npm/node_modules/which/bin/which from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-which-1.0.5-8.el6.noarch
file /usr/lib/node_modules/npm/node_modules/which/which.js from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-which-1.0.5-8.el6.noarch
file /usr/lib/node_modules/npm/node_modules/uid-number/package.json from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-uid-number-0.0.3-7.el6.noarch
file /usr/lib/node_modules/npm/node_modules/uid-number/get-uid-gid.js from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-uid-number-0.0.3-7.el6.noarch
file /usr/lib/node_modules/npm/node_modules/uid-number/uid-number.js from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-uid-number-0.0.3-7.el6.noarch
file /usr/lib/node_modules/npm/node_modules/osenv/package.json from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-osenv-0.0.3-5.el6.noarch
file /usr/lib/node_modules/npm/node_modules/osenv/osenv.js from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package nodejs-osenv-0.0.3-5.el6.noarch
file /usr/lib/node_modules/npm/bin/npm from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package npm-1.3.6-5.el6.noarch
file /usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp from install of nodejs-2:8.17.0-1nodesource.x86_64 conflicts with file from package npm-1.3.6-5.el6.noarch
file /usr/lib/node_modules/npm/node_modules/node-gyp from install of nodejs-
名单更长!
答案1
从部分列表中可以看出,您安装的版本nodejs
(8.17.0
在发布字符串中)与系统存储库提供的版本(在发布字符串中)nodesource
冲突。el6
现在,当您更新时,要么某些系统残留正在尝试更新,要么系统存储库提供了满足版本要求的更新来更新您已安装的软件包,但由于它们的打包方式或版本不同而存在冲突。系统包的依赖关系。
它可能足以告诉yum
跳过更新npm
(因为这至少是您显示的输出列表中的一个明显冲突,并且它可能负责引入其他冲突的更新)
sudo yum update --exclude=npm
如果您只想保留较新的nodejs
版本,您应该查找来自系统存储库的nodejs
/npm
软件包的所有痕迹(它们可能el6
在软件包发布字符串中)和yum remove
它们,以便更新的版本是仅有的剩余版本。但是,在执行此操作时,您可能会发现其他需要旧版本的软件包,并且在不考虑对系统的潜在影响的情况下,不应强制执行此操作。