6

sudo pacman -Syu

我尝试在我的 Manjaro Linux 上使用 pacman 更新所有软件包,pacman 必须尽一切努力下载所有可用软件包的最新更新,并且在检查文件冲突后,它会抛出

...
(126/126) checking keys in keyring  100%
(126/126) checking package integrity 100%
(126/126) loading package files 100%
(126/126) checking for file conflicts
error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/lib/exec/get-workspace-location-msg.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@npmcli/git/lib/utils.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/balanced-match/.github/FUNDING.yml exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/just-diff/index.d.ts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/just-diff/index.tests.ts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/CHANGELOG.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/LICENSE exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/README.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/lib/cache-install-dir.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/lib/manifest-missing.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/lib/no-tty.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/lib/run-script.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmexec/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/proc-log/LICENSE exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/proc-log/README.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/proc-log/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/proc-log/package.json exists in filesystem
Errors occurred, no packages were upgraded.

我是否应该为我假设全局安装的节点模块被覆盖的 node_modules 做任何特定的事情?

4

3 回答 3

6

首先删除 npm 包,然后删除 node_modules 目录是我用来完成这项工作的一种解决方法。但是,我不确定这是否是正确的解决方案。您可以在进行完整更新之前执行类似的操作,然后重新安装 npm。

$ sudo pacman -Rns npm
$ sudo rm -R /usr/lib/node_modules/npm/
$ sudo rm -R /usr/share/man/man1/
$ sudo pacman -Syyu
$ sudo pacman -S npm
于 2021-05-02T05:24:54.420 回答
4

你可以sudo pacman -S npm --overwrite '/usr/lib/node_modules/npm/*'

于 2021-05-25T10:27:57.427 回答
3

Just sudo rm -fr /usr/lib/node_modules will work too. node_modules is where npm compiles stuff to, so just remove the compilation contents.

于 2021-05-11T09:13:13.517 回答