Failed to commit transaction (conflicting files) when updating packages on Manjaro [closed]
Asked Answered
H

4

15

sudo pacman -Syu

I try updating all the packages using pacman on my Manjaro Linux and pacman necessarily does everything to download the latest updates of all the available packages and after checking for file conflicts, it throws

...
(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.

Should I have to do anything specific for the node_modules which I assume are the globally installed node modules to be over written or something?

Hygienist answered 2/5, 2021 at 5:18 Comment(0)
H
24

Removing the npm package first and then deleting node_modules directory is a workaround that I used to make this work. However, I am not sure if that is the right solution. You can do something like this before you do a full update and then install the npm back again.

$ 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
Hygienist answered 2/5, 2021 at 5:24 Comment(2)
what is the man/man1 removal?Dierolf
Please, change the line sudo rm -R /usr/share/man/man1/, which will make many people delete that folder, which is not exclusive from npm.Opportunist
A
19

You can sudo pacman -S npm --overwrite '/usr/lib/node_modules/npm/*'

Comment by the answer's author:

It basically resolves conflicts by overwriting files. In your case, conflicting files are all located in /usr/lib/node_modules/npm/ therefore the * will match all of them. No need to delete them manually with rm -r which would leave the package in an inconsistent state. It is good practice to update/upgrade afterward with sudo pacman -Syyu.

Atwater answered 25/5, 2021 at 10:27 Comment(3)
Could you provide more information? What does this command do?Nuke
It basically resolves conflicts by overwriting files. In your case conflicting files are all located in /usr/lib/node_modules/npm/ therefore the * will match all of them. No need to delete them manually with rm -r which would leave the package in inconsistent state. It is good practice to update/upgrade after with sudo pacman -SyyuAtwater
Could you add this to your answer?Nuke
S
6

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.

Scalping answered 11/5, 2021 at 9:13 Comment(1)
this is the easiest solution. You don't have to re-install npm or node.Suber
B
-4

better use this ->

pacman -Syu blackarch --overwrite '*'
Blackmon answered 16/5, 2022 at 15:39 Comment(1)
Why should I better use this?Y

© 2022 - 2024 — McMap. All rights reserved.