Npm errors during upgrade

Hello, I don’t use my laptop for a week and today I try to upgrade. I see errors like this:

➜ LANG=C yay -Syu
[sudo] password for mariank: 
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 endeavouros is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (114) akm-2.8.8-2  alsa-card-profiles-1:0.3.32-1  android-tools-31.0.2-1  bbswitch-dkms-0.8-432  btrfs-progs-5.13-1  ca-certificates-mozilla-3.68-1  ceph-libs-15.2.13-1  cmake-3.21.0-1  curl-7.78.0-1
               dtc-1.6.1-1  electron-13.1.7-1  elementary-icon-theme-6.0.0-1  eos-bash-shared-1.8.3-1  ethtool-1:5.13-1  firefox-90.0.1-1  firefox-i18n-pl-90.0.1-1  gnupg-2.2.29-1  go-2:1.16.6-1
               go-tools-4:0.1.5-1  granite-6.1.0-1  graphviz-2.48.0-1  gst-plugin-pipewire-1:0.3.32-1  gst-plugins-bad-1.18.4-9  gst-plugins-bad-libs-1.18.4-9  gtk-theme-elementary-6.0.0-1  hplip-1:3.21.6-1
               hwloc-2.5.0-1  imagemagick-7.1.0.4-1  imath-3.1.1-1  jdk-openjdk-16.0.2.u7-1  jdk11-openjdk-11.0.12.u7-1  jre-openjdk-16.0.2.u7-1  jre-openjdk-headless-16.0.2.u7-1  jre11-openjdk-11.0.12.u7-1
               jre11-openjdk-headless-11.0.12.u7-1  kio-5.84.0-2  ldb-1:2.4.0-1  less-1:590-1  lib32-at-spi2-core-2.40.3-1  lib32-curl-7.78.0-1  lib32-gtk3-3.24.30-1  lib32-mesa-21.1.5-1  lib32-nettle-3.7.3-1
               lib32-nss-3.68-1  lib32-nvidia-utils-470.57.02-1  lib32-opencl-mesa-21.1.5-1  lib32-systemd-249.1-1  lib32-tdb-1.4.4-1  lib32-vulkan-icd-loader-1.2.184-1  libbytesize-2.6-1  libjcat-0.1.8-1
               libmwaw-0.3.20-1  libnm-1.32.4-1  libuv-1.42.0-1  libwacom-1.11-1  libxmlb-0.3.2-1  libxnvctrl-470.57.02-1  linux-5.13.4.arch1-1  linux-firmware-20210716.b7c134f-1  linux-headers-5.13.4.arch1-1
               mbedtls-2.27.0-1  mesa-21.1.5-1  mkinitcpio-30-2  mpg123-1.28.2-1  mtools-1:4.0.33-1  networkmanager-1.32.4-1  nodejs-16.5.0-1  noto-fonts-emoji-20210625-1  npm-7.18.0-1  nss-3.68-1
               nvidia-dkms-470.57.02-3  nvidia-settings-470.57.02-1  nvidia-utils-470.57.02-3  opencl-mesa-21.1.5-1  openexr-3.0.5-2  os-prober-1.79-1  ostree-2021.3-1  pacman-6.0.0-5
               pacman-mirrorlist-20210718-1  perl-http-message-6.33-1  pipewire-1:0.3.32-1  pipewire-media-session-1:0.3.32-1  python-importlib-metadata-4.6.1-1  python-matplotlib-3.4.2-2
               python-more-itertools-8.8.0-1  python-pep517-0.11.0-1  python-pikepdf-2.15.1-1  python-requests-2.26.0-1  python-setuptools-1:57.4.0-1  python-sphinx-4.1.1-1  python-tomli-1.0.4-1
               python-uvloop-0.15.3-1  qt5-wayland-5.15.2+kde+r29-1  r8168-8.049.02-4  rclone-1.56.0-1  reflector-simple-1.17-1  rhash-1.4.2-1  rpcbind-1.2.6-1  samba-4.14.6-1  smbclient-4.14.6-1
               systemd-249.1-1  systemd-libs-249.1-1  systemd-sysvcompat-249.1-1  talloc-2.3.3-1  tdb-1.4.4-1  tevent-1:0.11.0-1  thunderbird-78.12.0-1  thunderbird-i18n-pl-78.12.0-1  vpnc-1:0.5.3.r496.r153-2
               vulkan-headers-1:1.2.184-1  vulkan-icd-loader-1.2.184-1  wine-staging-6.13-1  yay-10.3.0-1  zimg-3.0.2-1

Total Installed Size:  4816,72 MiB
Net Upgrade Size:        85,27 MiB

:: Proceed with installation? [Y/n] y
(114/114) checking keys in keyring                                                                                              [-----------------------------------------------------------------------------] 100%
(114/114) checking package integrity                                                                                            [-----------------------------------------------------------------------------] 100%
(114/114) loading package files                                                                                                 [-----------------------------------------------------------------------------] 100%
(114/114) checking for file conflicts                                                                                           [-----------------------------------------------------------------------------] 100%
error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/.eslintrc.json exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/.npmignore exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/CHANGELOG.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/README.md exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/tap-snapshots/test/format-diff.js.test.cjs exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/tap-snapshots/test/index.js.test.cjs exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/tap-snapshots/test/untar.js.test.cjs exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/fixtures/archive.tgz exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/fixtures/ruyadorno-simplistic-pkg-with-folders-1.0.0.tgz exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/fixtures/simple-output-2.2.1.tgz exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/format-diff.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/index.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/should-print-patch.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/tarball.js exists in filesystem
npm: /usr/lib/node_modules/npm/node_modules/libnpmdiff/test/untar.js exists in filesystem
Errors occurred, no packages were upgraded.
error installing repo packages

Regards,
Przemek

Easy :upside_down_face:

2 Likes

Hi, If I have that notice:
error: No package owns /path/to/file
that means I can remove that files?
Regards.

Well that’s different question, however - if it’s not something that you have explicitly installed yourself and it comes from package - yes, you can remove those files.

I try to remove but:

➜ LANG=C sudo pacman -R /usr/lib/node_modules/npm/node_modules/libnpmdiff/.eslintrc.json
error: target not found: /usr/lib/node_modules/npm/node_modules/libnpmdiff/.eslintrc.json

Have you read the FAQ link?
Please read it more carefully :upside_down_face:

1 Like

For removing npm with deps.
(-R = remove … -n = dependencies)

$ pacman -Rn npm 

@ericbandrakim I don’t want to remove whole npm. I think I need this for some apps.
Regards.

Reinstall it before upgrade.

pacman -S --force --noconfirm npm

ps i am not a dev … this is what i would try to reinstall npm

Tip link from @keybreak

You need to specific the path :::: you looked for /path/to/file … this is an example
You need to put in the right location path, for example like —>

/usr/lib/node_modules/npm/node_modules/libnpmdiff/.eslintrc.json

Hi, I know. I put location. That was only exaple.

1 Like

ok clear :slight_smile:

I try but:

➜ LANG=C sudo pacman -S --force --noconfirm npm
error: invalid option '--force'

your right :expressionless:

What do You mean. I try remove, owerride but don’t work. What else I can do?
Regards.

If no package owns the conflicting files, then you could remove them by rm command (and not by pacman -R as you did before) and run the update again.

OR:

The “I don’t care” way

sudo pacman -S $PACKAGE --overwrite '*'

From the link posted before in the thread.

Try:
sudo pacman -Syu --overwrite '*'

2 Likes

That works. Thanks :smiley:
Regards.

1 Like

came across this link

https://bbs.archlinux.org/viewtopic.php?id=260286

edit → another option = update npm

EDIT 2 :: This is only useful if npm is installed with npm and not with pacman or yay.
Did you install npm with npm ?

$ npm r -g npm

PS ::: for what i read on arch wiki.

–overwrite is the last option to take with pacman.

https://wiki.archlinux.org/title/Pacman#"Failed_to_commit_transaction_(conflicting_files)"_error

1 Like

Just so you know, by “read it more carefully” i meant literally that :laughing:
What @pebcak posted was written in first reply inside FAQ link :upside_down_face:

2 Likes

ps :::: small thingie

To avoid confusion about the output → post the exact output. It also can give other details not thought of.