Ubuntu,无法安装zlib1g-dev

时间:2018-01-13 20:23:06

标签: node.js ubuntu zlib

我正在尝试在Ubuntu中安装nodejs,在检查了所有缺少的依赖项后,我在安装zlib1g-dev时遇到问题,zlib1g已经在1:1.2.8.dfsg-2ubuntu4.1:

[pp@src]$ sudo apt-get install zlib1g-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 zlib1g-dev : **Depends: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) but 1:1.2.8.dfsg-2ubuntu4.1 is to be installed**
E: Unable to correct problems, you have held broken packages.


[pp@src]$ sudo apt-get install zlib1g

Reading package lists... Done
Building dependency tree       
Reading state information... Done
**zlib1g is already the newest version (1:1.2.8.dfsg-2ubuntu4.1)**.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

3 个答案:

答案 0 :(得分:1)

我能够通过以下方式进行安装:

sudo apt-get update&& sudo sudo apt-get install zlib1g-dev

使用以下内容更新/etc/apt/sources.list后:

#------------------------------------------------------------------------------#
#                            OFFICIAL UBUNTU REPOS                             #
#------------------------------------------------------------------------------#


###### Ubuntu Main Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse 

###### Ubuntu Update Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse 
deb http://us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse 
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse 

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner

答案 1 :(得分:0)

我会尝试sudo apt-get update开始(有时问题很简单!)。 考虑包括dpkg --get-selections | grep hold的结果 在评论中。

Autoremove也可以提供帮助!

最后,再次尝试使用aptitude(https://unix.stackexchange.com/questions/767/what-is-the-real-difference-between-apt-get-and-aptitude-how-about-wajig)可能会突出问题。

很难在没有更多信息的情况下进行诊断。

答案 2 :(得分:0)

SeinopSys在Error installing zlib1g-dev中给出了答案 您需要记下所需的软件包版本(在您的情况下为= = 1:1.2.8.dfsg-2ubuntu4),然后运行以下命令将其降级为该版本:

$ sudo apt install zlib1g== 1:1.2.8.dfsg-2ubuntu4

然后您可以尝试重新安装。