Unable to update pacman due to npm conflict

I tried to update my system, and got the following error:

error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/lib/cli-entry.js exists in filesystem
npm: /usr/lib/node_modules/npm/lib/commands/login.js exists in filesystem
npm: /usr/lib/node_modules/npm/lib/es6/validate-engines.js exists in filesystem
npm: /usr/lib/node_modules/npm/lib/utils/auth.js exists in filesystem
npm: /usr/lib/node_modules/npm/lib/utils/completion.fish exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/LICENSE.txt exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/build/index.cjs exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/build/index.d.cts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/build/lib/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/index.mjs exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/LICENSE-MIT.txt exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/RGI_Emoji.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/RGI_Emoji.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/es2015/text.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex/text.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/@isaacs/cliui/package.json exists in filesystem

[...]

Errors occurred, no packages were upgraded.

(the error output is longer, but repetitive, so I only pasted a part of it here)

How could I troubleshoot this? Should I just ignore the npm-related packages, and allow the rest of the update to proceed?


Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

Your error is caused by improper use of sudo npm install <pkgname> - never do so …

Hey, thanks for the quick reply. That helped. Thank you.

This happened to me today. I tried to use sudo pacman -Syu and yay -Syu but same thing happened as OP’s then I tried updating through pacman’s GUI package manager and it prompted me to restart my system to apply changes (it also gave a shorter version of the error message) and after restarting it looks like the updates were applied but I have no idea what happened so if any light could be shed that would be appreciated :smiley:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.