我正在尝试在我的 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
开始吧,您的 Node 版本现在是 v8.4.0。
17/01 编辑: --force 已弃用。请使用 --overwrite
关于node.js - 升级到 Nodejs 8 和 "error: failed to commit transaction",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45000674/