Force install npm in Arch Linux

Paras Nath Chaudhary · February 13, 2020

I have been using Arch Linux for the past couple of years. Last year, I changed to Manjaro, which is also an Arch Linux based distro. Recently, I came across a problem after I was trying to update the system. Here I will explain the problem that I faced and the solution. In the past, whenever I updated the packages and had any issue I was able to use –force option. This option used to solve almost all of my problems. The recent version of pacman/yaourt does not have the –force option.

Today while I was updating npm I got into a similar situation. The error was as follows:

error: failed to commit transaction (conflicting files)
npm: /usr/lib/node_modules/npm/lib/utils/stringify-package.js exists in filesystem

// lines clipped ...

Errors occurred, no packages were upgraded.

I searched the internet for a while then I stumbled upon this issue. It is the solution by n0noob. The solution is to use –overwrite=’*‘.

So the final command would be

sudo pacman -S npm –overwrite=’*’

And this solved my problem. This applies to Arch Linux and other distros based on Arch Linux.

Caution: Use –overwrite=’*’ at your own risk. This command might result in an unusable system. Use it only if you know what you are doing.

Twitter, Facebook