E: 包 '<any package>' 没有安装候选

twi*_*kes 4 apt package-management

我无法 apt-get 安装任何软件包,因为E: Package '<package name>' has no installation candidate. 与其他类似命名的问题不同,我使用的是 debian,但由于相同的错误,我无法使任何软件包正常工作。apt 仍然能够列出存储库。在尝试修复sources.list后,我已经更新、升级、重新启动并重复了,但没有任何效果。

例如,

$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package nodejs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'nodejs' has no installation candidate
Run Code Online (Sandbox Code Playgroud)

运行$ find /etc/apt/ -path *.list | xargs cat产生:

#------------------------------------------------------------------------------#
#                   OFFICIAL DEBIAN REPOS                    
#------------------------------------------------------------------------------#

###### Debian Main Repos
deb http://ftp.us.debian.org/debian/ jessie main contrib non-free 
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free 

###### Debian Update Repos
deb http://security.debian.org/ jessie/updates main contrib non-free 
deb http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free 
deb-src http://security.debian.org/ jessie/updates main contrib non-free 
deb-src http://ftp.us.debian.org/debian/ jessie-proposed-updates main contrib non-free 


deb http://archive.raspberrypi.org/debian/ jessie main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://archive.raspberrypi.org/debian/ jessie main ui
deb https://dev2day.de/pms/ jessie main
deb http://dl.bintray.com/openhab/apt-repo stable main
Run Code Online (Sandbox Code Playgroud)

Bra*_*iam 5

有几种可能性:

  • 您的列表不能更新,请使用apt-get update. 您还应该检查是否apt-cache policy列出了所有存储库。
  • 该包可能在您添加的存储库源或其他组件中不可用。对于 Debian,使用madison,其他发行版有等价物。例如,对于该包,您需要:

    nodejs     | 0.10.29~dfsg-1~bpo70+1 | wheezy-backports | source, amd64, armel, armhf, i386, kfreebsd-amd64, kfreebsd-i386
    nodejs     | 0.10.29~dfsg-2         | stable           | source, amd64, armel, armhf, i386, mipsel
    nodejs     | 0.10.29~dfsg-2         | stable-kfreebsd  | source, kfreebsd-amd64, kfreebsd-i386
    nodejs     | 4.3.1~dfsg-3           | testing          | source, amd64, arm64, armel, armhf, i386, mips, mipsel, powerpc, ppc64el, s390x
    nodejs     | 4.4.7~dfsg-2           | unstable         | source, amd64, arm64, armhf, i386, kfreebsd-amd64, kfreebsd-i386, mips, mips64el, mipsel, powerpc, ppc64el, s390x
    nodejs     | 5.11.0~dfsg-1          | experimental     | source, mipsel
    nodejs     | 6.0.0~dfsg-1           | experimental     | source, amd64, arm64, armel, armhf, i386, kfreebsd-amd64, kfreebsd-i386, mips, mips64el, powerpc, ppc64el, s390x
    
    Run Code Online (Sandbox Code Playgroud)

    这些存储库未启用或位于您尚未添加的组件中(即 main、contrib、non-free)。

  • 该软件包也可能不适用于您的架构。使用dpkg --print-architecture知道你正在使用的架构,并与麦迪逊输出比较。

如果其中任何一个失败,您将收到该消息。检查apt-cache policy package以验证本地包列表是否包含该包。