Pacman

Pacman

使用

安装指定包

1
sudo pacman -S package_name

查看哪些包属于指定包组

1
pacman -Sq plasma

安装一个本地包

1
sudo pacman -U /path/to/package/package_name-version.pkg.tar.xz

移除指定包

移除指定包,保留其依赖。

1
sudo pacman -R package_naem

移除指定包及其不被其他包依赖的依赖。

1
sudo pacman -Rs package_name

升级包

pacman 不支持部分升级。

查询包

查询在数据库中的包,会搜索包名和描述。

1
sudo pacman -Ss string

查询已安装的包。

1
sudo pacman -Qs string

显示软件包的依赖树

需要先安装pacman-contrib

1
pactree git

定期清理软件包缓存

需要先安装pacman-contrib

1
paccache -r

设置保留几个最近的版本:

1
paccache -rk1

配置

配置文件位于/etc/pacman.conf

镜像

/etc/pacman.d/mirrorlist/

报错

“Failed to commit transaction (conflicting files)” 错误

error: could not prepare transaction
error: failed to commit transaction (conflicting files)
package: /usr/lib/node_modules/node-gyp/.github/workflows/tests.yml exists in filesystem
Errors occurred, no packages were upgraded.

https://wiki.archlinux.org/index.php/Pacman_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)#%22Failed_to_commit_transaction_(conflicting_files)%22_%E9%94%99%E8%AF%AF

官方有解决方案,不过因为我这是 node_modules 的问题。所以我选择:
sudo npm uninstall node-gyp -g

再 sudo pacman -Syu
但遇到了 wanring
warning: could not get file information for usr/lib/node_modules/node-gyp/node_modules/safer-buffer/Porting-Buffer.md
warning: could not get file information for usr/lib/node_modules/node-gyp/node_modules/safer-buffer/Readme.md
warning: could not get file information for usr/lib/node_modules/node-gyp/node_modules/safer-buffer/dangerous.js
warning: could not get file information for usr/lib/node_modules/node-gyp/node_modules/safer-buffer/package.json


warning: could not get file information for usr/lib/node_modules/node-gyp/test/test-install.js
warning: could not get file information for usr/lib/node_modules/node-gyp/test/test-options.js
warning: could not get file information for usr/lib/node_modules/node-gyp/test/test-process-release.js
warning: could not get file information for usr/lib/node_modules/node-gyp/update-gyp.py

但也成功安装了,谨此记录。

参考

pacman - ArchWiki