Upgrading to Nodejs 8 and "error: failed to commit transaction"

Upgrading to Nodejs 8 and "error: failed to commit transaction"

我正在尝试将我的 arch linux 中的 nodejs 6 升级到 8。所以我做了:

$ sudo pacman -S nodejs npm

结果:

resolving dependencies...
looking for conflicting packages...

Packages (3) openssl-1.0-1.0.2.l-1  nodejs-8.1.3-1  npm-4.6.1-1

Total Installed Size:  39.22 MiB
Net Upgrade Size:       6.79 MiB

:: Proceed with installation? [Y/n] y
(3/3) checking keys in keyring                                                                                    [####################################################################] 100%
(3/3) checking package integrity                                                                                  [####################################################################] 100%
(3/3) loading package files                                                                                       [####################################################################] 100%
(3/3) checking for file conflicts                                                                                 [####################################################################] 100%
error: failed to commit transaction (conflicting files)
openssl-1.0: /usr/lib/libcrypto.so.1.0.0 exists in filesystem
openssl-1.0: /usr/lib/libssl.so.1.0.0 exists in filesystem
Errors occurred, no packages were upgraded.

我想现在我的 nodejs 坏了!

$ node --version
node: error while loading shared libraries: libhttp_parser.so.2.7.1: cannot open shared object file: No such file or directory

知道我现在应该做什么吗?

我遇到了同样的问题,我是这样解决的:

sudo pacman -S nodejs npm --force

选项 --force 将升级您的包,即使您收到有关现有文件的警告。

之后你需要用 pacman 安装 http-parser :

sudo pacman -S http-parser --force

最后,node -v 会给你这个错误:

error while loading shared libraries: libicui18n.so.59: cannot open shared object file: No such file or directory

要修复它,请从 pacman 安装 icu 库:

sudo pacman -S icu --force

开始吧,您的节点版本现在是 v8.4.0。

17 月 1 日编辑: --force 已弃用。请使用 --overwrite