为什么尽管 nodejs 提供了 npm,apt 仍尝试安装 npm?

为什么尽管 nodejs 提供了 npm,apt 仍尝试安装 npm?

我正在使用 nodesource 存储库在 Ubuntu Xenial 上安装 nodejs,当需要安装包 npm 时,apt 会尝试安装实际的 npm 包。这让我很困惑,因为已安装的 nodejs 包将 npm 作为虚拟包提供:

Package: nodejs
Version: 8.11.2-1nodesource1
Architecture: amd64
Maintainer: Chris Lea <[email protected]>
Installed-Size: 59949
Depends: libc6 (>= 2.7), libgcc1 (>= 1:3.4), libstdc++6 (>= 4.4.0), python-minimal, ca-certificates
Conflicts: nodejs-dev, nodejs-legacy, npm
Replaces: nodejs-dev (<= 0.8.22), nodejs-legacy, npm (<= 1.2.14)
Provides: nodejs-dev, nodejs-legacy, npm
Homepage: https://nodejs.org
Priority: optional
Section: web
Filename: pool/main/n/nodejs/nodejs_8.11.2-1nodesource1_amd64.deb
Size: 12650798
SHA256: d0d334108873d23567df07e120c82796582296702c50c48546def2772badfa0b
SHA1: 301d07117fd6989ff9833b3d5a6218a097d5be18
MD5sum: 0c12a6e18edc15fd11ee9bb1cacbab70
Description: Node.js event-based server-side javascript engine
 Node.js is similar in design to and influenced by systems like
 Ruby's Event Machine or Python's Twisted.
 .
 It takes the event model a bit further - it presents the event
 loop as a language construct instead of as a library.
 .
 Node.js is bundled with several useful libraries to handle server tasks :
 System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
 HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.

我的理解是,在 上apt-get install npm,系统应该指出包 npm 已安装,但它尝试安装与 nodejs 冲突的 npm 包。此外,列出安装候选包apt-cache policy不会将 nodesource 包列为候选包,根据我的理解,这是错误的:

# apt-cache policy npm
npm:
  Installed: (none)
  Candidate: 3.5.2-0ubuntu4
  Version table:
     3.5.2-0ubuntu4 500
        500 http://de.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
     1.3.10~dfsg-1 500
        500 http://archive.ubuntu.com/ubuntu trusty/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu trusty/universe i386 Packages

相关内容