E: Unable to correct problems, you have held broken packages
Solution 1:
Use aptitude instead of apt-get. It is more intelligent. It not only will handle downgrading conflicting packages for you, but will make a series of recommendations asking you which of many possible suggested working scenarios you would like.
sudo aptitude install myNewPackage
If you don't have aptitude on your machine yet, get it with
sudo apt-get install aptitude
Solution 2:
You should be able to see the list of held packages by:
apt-mark showhold
and then un-hold them by
sudo apt-mark unhold <package name>
After that, you should be able to remove the conflicting package (it seems to be npm
) and then reinstall all.
If this fail, you can try the aptitude
way --- often it's able to disentangle dependency trees better.
In both cases, be careful when applying commands, and check carefully the list of packages that are marked for remove.
Solution 3:
For me to solve this problem, I just had to install synaptic first using below commmand, and then everything works fine.
sudo apt-get install synaptic
Solution 4:
I found out that dpkg -r
allows me to remove packages one-by-one, without triggering a cascade of other behaviour.
I am not sure this is a good solution, but I went with it and everything seems fine.