Non useful errors

Why is it that whenever I try to update something through Pamac or Pacman I get non-useful errors when some package fails to installs and gives me errors like this;

error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/LICENSE.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/LICENSE.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/base-theme.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/demo.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/error.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/has-color.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/plumbing.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/process.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/progress-bar.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/render-template.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/set-immediate.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/set-interval.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/spin.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/template-item.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/theme-set.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/themes.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/lib/wide-truncate.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/ansi-regex/index.d.ts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/ansi-regex/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/ansi-regex/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/ansi-regex/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.d.ts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/is-fullwidth-code-point/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/string-width/index.d.ts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/string-width/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/string-width/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/string-width/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/strip-ansi/index.d.ts exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/strip-ansi/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/strip-ansi/license exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/gauge/node_modules/strip-ansi/package.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/npmlog/LICENSE.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/npmlog/lib/log.js exists in filesystem
Errors occurred, no packages were upgraded.

If I choose to update something I shouldn’t be presented with non-harmful errors like this. If the package or file or whatever exists in the system and I’m being thrown errors like this and causing the package manager to fail install of a package or upgrade. If these files already exist within the filesystem, just UPDATE, overwrite them if you have to, I don’t really care. If one package provides something that already exists in the package, just ignore and use those files. Is it really that hard? It’s not like you’re gonna break something, especially when the files are just LICENCE.md or some text or script file like JSON, TXT, JS.

NPM is the outlier here which always breaks and causes issues for other packages, because Node’s packaging is so inconsistent and broken half the time. This why I never like using NPM because it always causes issues, but there are some applications that rely on using NPM which I can’t avoid. Telling the user some file exists in the filesystem is a non-useful error to stop a package update on. If it exists so what, just ignore it and move on with the package install/upgrade, NPM shouldn’t force the package manager to stop for something that isn’t even an error when it’s only a warning, they should be treated as warnings not errors. This probably not even the right place to complain about NPM, and should probably go the devs talk channels and complain directly there about how stupid their packaging system is. – But thing is this also sometimes happens for non NPM packages also, the package manager will halt on warnings like the above that are being treated as errors when they’re really not. It’s not like it’s going to break a compiled binary or library in some grand spectacular way that causes the system to implode on itself.

IF the file exists already, either overwrite it, or ignore it completely.

This question gets asked constantly and is easily solved. Did you know the forum has a search function?

sudo pacman -Syyu --overwrite "*"

Note: Use the --overwrite flag with pacman only when this error is encountered. It could cause problems otherwise.

1 Like

Well … the first thing really is that

Because you are abusing sudo and npm probably.
sudo npm ... is not how you should manage your node.js packages.

I’m gonna skip the ranting above this closing line because I think it sums it up perfectly - you dont really understand how this works and your proposed solution is a nightmare scenario supplanting sane package management.
pacman/alpm works this way on purpose, and it is a good thing. If you dont like it … you can continue to do things improperly and breaking things and then complaining … or you can just use a less-sane operating system like windoze and rejoice.

4 Likes

If we were being even marginally careful about using overwrite then we dont want to just use a wildcard … something like this would be more applicable/safer, though as stated above, this is a system problem created by OP, and this ‘solve’ only a few steps away from ‘going nuclear’:

sudo pacman -Syyu --overwrite "/usr/lib/node_modules/npm/node_modules/*"
4 Likes

False assumption, but OK, go off.

Well those files arent present in a new install and they didnt just materialize on their own.

Lets see if any package owns them…

pacman -Qo /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/LICENSE.md