broken packages error while installing npm on ubuntu
I'm trying to install gtop on my Ubuntu machine. For that I need to install nodejs and npm package manager. First I installed nodejs with sudo apt install nodejs
and it get installed fine, but for installing npm I got this dependency error message:
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.1j-1ubuntu3) but 1.1.1j-1ubuntu3.5
is to be installed
libuv1-dev : Depends: libuv1 (= 1.40.0-1) but 1.40.0-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.
I updated and upgraded the system and reinstalled nodejs and even updated with --fix-missing
but I still have the same problem.
Results of apt-cache policy libuv1
:
libuv1:
Installed: 1.40.0-1ubuntu0.1
Candidate: 1.40.0-1ubuntu0.1
Version table:
*** 1.40.0-1ubuntu0.1 100
100 /var/lib/dpkg/status
1.40.0-1 500
500 http://cz.archive.ubuntu.com/ubuntu hirsute/main amd64 Packages
I've got these repositories:
$ grep -r deb /etc/apt/sources.list /etc/apt/sources.list.d/.
/etc/apt/sources.list: # deb cdrom:[Ubuntu 21.04 _Hirsute Hippo_ - Release amd64 (20210420)]/ hirsute main restricted
/etc/apt/sources.list:deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute restricted
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute main restricted
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute-updates main restricted
/etc/apt/sources.list:deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute universe
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute universe
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute-updates universe
/etc/apt/sources.list:deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute multiverse
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute multiverse
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute-updates multiverse
/etc/apt/sources.list:# deb-src http://ir.archive.ubuntu.com/ubuntu/ hirsute-backports main restricted universe multiverse
/etc/apt/sources.list:# deb http://archive.canonical.com/ubuntu hirsute partner
/etc/apt/sources.list:# deb-src http://archive.canonical.com/ubuntu hirsute partner
/etc/apt/sources.list:deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute-security restricted
/etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu hirsute-security main restricted
/etc/apt/sources.list:deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute-security universe
/etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu hirsute-security universe
/etc/apt/sources.list:deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute-security multiverse
/etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu hirsute-security multiverse
/etc/apt/sources.list:# (e.g. netinst, live or single CD). The matching "deb cdrom"
/etc/apt/sources.list:deb http://cz.archive.ubuntu.com/ubuntu hirsute main
/etc/apt/sources.list.d/./vscode.list:deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
/etc/apt/sources.list.d/./windscribe-repo.list.save:deb https://repo.windscribe.com/ubuntu bionic main
/etc/apt/sources.list.d/./windscribe-repo.list:deb https://repo.windscribe.com/ubuntu bionic main
/etc/apt/sources.list.d/./vscode.list.save:deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
Your repositories miss the main, hirsute-updates and hirsute-security components. At first add them by using commands below
sudo add-apt-repository -r "deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute restricted"
sudo add-apt-repository -r "deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute universe"
sudo add-apt-repository -r "deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute multiverse"
sudo add-apt-repository -r "deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute-security restricted"
sudo add-apt-repository -r "deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute-security universe"
sudo add-apt-repository -r "deb http://repo.iut.ac.ir/repo/Ubuntu/ hirsute-security multiverse"
sudo add-apt-repository "deb http://cz.archive.ubuntu.com/ubuntu hirsute universe multiverse restricted"
sudo add-apt-repository "deb http://cz.archive.ubuntu.com/ubuntu hirsute-security main universe multiverse restricted"
sudo add-apt-repository "deb http://cz.archive.ubuntu.com/ubuntu hirsute-updates main universe multiverse restricted"
Then update package lists and install all needed upgrades with new dependencies by
sudo apt-get update
sudo apt-get dist-upgrade
and retry.