我正在使用几天前安装的Ubuntu 13.04。我正在尝试安装nodejsnpm。我尝试先从命令行安装,然后将其卸载。然后出现故障。

sudo apt-get install -f nodejs npm
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:
 nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.


/etc/apt/sources.list的输出如下:

# deb cdrom:[Ubuntu 13.04 _Raring Ringtail_ - Release amd64 (20130424)]/ raring main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ raring main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ raring main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ raring-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ raring-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ raring universe
deb-src http://in.archive.ubuntu.com/ubuntu/ raring universe
deb http://in.archive.ubuntu.com/ubuntu/ raring-updates universe
deb-src http://in.archive.ubuntu.com/ubuntu/ raring-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ raring multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ raring multiverse
deb http://in.archive.ubuntu.com/ubuntu/ raring-updates multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ raring-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ raring-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu raring-security main restricted
deb-src http://security.ubuntu.com/ubuntu raring-security main restricted
deb http://security.ubuntu.com/ubuntu raring-security universe
deb-src http://security.ubuntu.com/ubuntu raring-security universe
deb http://security.ubuntu.com/ubuntu raring-security multiverse
deb-src http://security.ubuntu.com/ubuntu raring-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu raring partner
# deb-src http://archive.canonical.com/ubuntu raring partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu raring main
deb-src http://extras.ubuntu.com/ubuntu raring main


/etc/apt/sources.list.d/*的输出为下方:

deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu raring main
# deb-src http://ppa.launchpad.net/chris-lea/node.js/ubuntu raring main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http://dl.google.com/linux/chrome/deb/ stable main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http://dl.google.com/linux/chrome/deb/ stable main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://deb.opera.com/opera/ stable non-free
deb http://deb.opera.com/opera/ stable non-free
deb http://deb.opera.com/opera/ stable non-free
deb http://deb.opera.com/opera/ stable non-free


评论

不知道是什么问题,但是这可以帮助您转到突触包管理器。编辑>修复损坏的程序包。

当我做“ gksudo突触”时什么也没发生

您需要先安装它sudo apt-get update sudo apt-get upgrade sudo apt-get install synaptic

可以得到类似错误的另一种方法(尽管显然不是针对OP的)是设置APT :: Default-Release。如果这需要从比已经存在的依赖项更旧的版本中安装软件包,则它们可能不兼容,这会给您同样的错误。
这回答了你的问题了吗?无法纠正问题,您拿着破损的包裹

#1 楼

您应该可以通过以下方式查看保存的软件包的列表:

apt-mark showhold 


,然后通过

sudo apt-mark unhold <package name>

取消保留它们
之后,您应该可以删除有冲突的软件包(似乎是npm),然后重新安装所有软件包。

如果失败,您可以尝试使用aptitude方法-通常,它可以更好地分解依赖树。

在两种情况下,应用命令时都要小心,并仔细检查标记为删除的软件包列表。

评论


当我用wine1.6尝试时,apt-mark showhold不会输出任何内容。还有其他想法吗? (我也在Ask Ubuntu聊天中):)

–马达拉的幽灵
2013年12月21日在11:18

对。我也是。对我来说,这个命令永远不会输出任何东西。

– yPhil
14年4月13日在17:37

致读者:请务必查看@DragonLord的技巧来使用aptitude!效果很好。

–user146300
16年7月22日在9:33

是的,我同意---通常,智能可以比普通apt更好地分解依赖树。

–罗马诺
16年7月23日在8:34

apt-mark showhold对我没有任何帮助。

–kRazzy R
17年11月10日在23:26

#2 楼

使用aptitude代替apt-get。它更智能。它不仅会为您处理降级的软件包的降级,还将提出一系列建议,询问您想要哪种可能的建议工作方案。

还没有足够的机器知识,请使用

sudo aptitude install myNewPackage


评论


最好的答案。最近几天,我尝试了apt-get。有了才华,这在几秒钟内就解决了:-)

–约翰·卡尔森(Johan Karlsson)
2014年9月4日上午10:58

谢谢。我花了很多时间阅读解决问题的不同方法,apt-get并不能解释说当才干提出特定问题甚至提供解决方案时,我感到惊讶。

– bmacnaughton
15年4月29日在0:54

此解决方案的一个缺点:如果您的软件包首先被破坏,则无法执行sudo apt-get install aptitude。

–user13161
17 Mar 15 '17 at 20:08

谢谢一大堆!为我工作!能够摆脱被拘留(apt-get)超过两天。能力真的很聪明! [Ubuntu MATE 18.04.1 LTS,内核Linux 4.15.0-45-通用x86_64,MATE 1.20.1]

– ADEBISI Foluso A.
19年2月5日在15:23

哇!才能真好!我的mysql安装遇到了几个问题,幸运的是,它解决了我删除的一系列不良依赖的问题。

–?uday
19年8月8日在14:59

#3 楼

对于我来说,要解决此问题,我只需要先使用下面的命令安装突触,然后一切正常。

#4 楼

我发现dpkg -r允许我一个接一个地删除软件包,而不会触发其他一系列行为。很好。

评论


选择是一个更好的工具(虽然有点学习曲线,但提供了更多反馈)。

–同构
17年8月1日在22:37