首页 > 解决方案 > 如何在 debian 上安装 npm,收到 Unable to correct questions,你有损坏的包

问题描述

我正在尝试在运行的 debian VM 中安装 npm

sudo apt-get install -y 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:
 npm : Depends: nodejs (>= 6.11~) but it is not going to be installed
       Depends: node-abbrev (>= 1.1.1~) but it is not going to be installed
       Depends: node-ansi-regex (>= 3.0~) but it is not going to be installed
       Depends: node-ansistyles (>= 0.1.3~) but it is not going to be installed
       Depends: node-aproba (>= 1.2~) but it is not going to be installed
       Depends: node-archy (>= 1.0~) but it is not going to be installed
       Depends: node-cacache (>= 10.0.4~) but it is not going to be installed
       Depends: node-bluebird (>= 3.5.1~) but it is not going to be installed
       Depends: node-call-limit (>= 1.1~) but it is not going to be installed
       Depends: node-chownr (>= 1.0.1~) but it is not going to be installed
       Depends: node-config-chain (>= 1.1.11~) but it is not going to be installed
       Depends: node-detect-indent (>= 5.0~) but it is not going to be installed
       Depends: node-detect-newline (>= 2.1~) but it is not going to be installed
       Depends: node-editor (>= 1.0~) but it is not going to be installed
       Depends: node-fs-vacuum (>= 1.2.10~) but it is not going to be installed
       Depends: node-fs-write-stream-atomic (>= 1.0.10~) but it is not going to be installed
       Depends: node-glob (>= 7.1.2~) but it is not going to be installed
       Depends: node-graceful-fs (>= 4.1.11~) but it is not going to be installed
       Depends: node-has-unicode (>= 2.0.1~) but it is not going to be installed
       Depends: node-hosted-git-info (>= 2.6~) but it is not going to be installed
       Depends: node-iferr (>= 0.1.5~) but it is not going to be installed
       Depends: node-inflight (>= 1.0.6~) but it is not going to be installed
       Depends: node-inherits (>= 2.0.3~) but it is not going to be installed
       Depends: node-ini (>= 1.3.5~) but it is not going to be installed
       Depends: node-npm-package-arg but it is not going to be installed
       Depends: node-promzard but it is not going to be installed
       Depends: node-jsonstream (>= 1.3.2~) but it is not going to be installed
       Depends: node-json-parse-better-errors (>= 1.0.1~) but it is not going to be installed
       Depends: node-lazy-property (>= 1.0~) but it is not going to be installed
       Depends: node-libnpx (>= 10.0.1~) but it is not going to be installed
       Depends: node-lockfile (>= 1.0.3~) but it is not going to be installed
       Depends: node-lru-cache (>= 4.1.1~) but it is not going to be installed
       Depends: node-mississippi (>= 3.0~) but it is not going to be installed
       Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
       Depends: node-move-concurrently (>= 1.0.1~) but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-normalize-package-data (>= 2.4~) but it is not going to be installed
       Depends: node-gyp (>= 3.6.2~) but it is not going to be installed
       Depends: node-resolve-from (>= 4.0~) but it is not going to be installed
       Depends: node-encoding but it is not going to be installed
       Depends: node-errno but it is not going to be installed
       Depends: node-npmlog (>= 4.1.2~) but it is not going to be installed
       Depends: node-once (>= 1.4~) but it is not going to be installed
       Depends: node-opener (>= 1.4.3~) but it is not going to be installed
       Depends: node-osenv (>= 0.1.5~) but it is not going to be installed
       Depends: node-path-is-inside (>= 1.0.2~) but it is not going to be installed
       Depends: node-promise-inflight (>= 1.0.1~) but it is not going to be installed
       Depends: node-ansi but it is not going to be installed
       Depends: node-qw (>= 1.0.1~) but it is not going to be installed
       Depends: node-read (>= 1.0.7~) but it is not going to be installed
       Depends: node-read-package-json (>= 2.0.13~) but it is not going to be installed
       Depends: node-request (>= 2.83~) but it is not going to be installed
       Depends: node-retry (>= 0.10.1~) but it is not going to be installed
       Depends: node-rimraf (>= 2.6.2~) but it is not going to be installed
       Depends: node-safe-buffer (>= 5.1.1~) but it is not going to be installed
       Depends: node-semver (>= 5.5~) but it is not going to be installed
       Depends: node-sha (>= 2.0.1~) but it is not going to be installed
       Depends: node-slide (>= 1.1.6~) but it is not going to be installed
       Depends: node-sorted-object (>= 2.0.1~) but it is not going to be installed
       Depends: node-from2 but it is not going to be installed
       Depends: node-stream-iterate but it is not going to be installed
       Depends: node-ssri (>= 5.2.4~) but it is not going to be installed
       Depends: node-strip-ansi (>= 4.0~) but it is not going to be installed
       Depends: node-tar (>= 4.4~) but it is not going to be installed
       Depends: node-text-table (>= 0.2~) but it is not going to be installed
       Depends: node-uid-number (>= 0.0.6~) but it is not going to be installed
       Depends: node-unique-filename (>= 1.1~) but it is not going to be installed
       Depends: node-unpipe (>= 1.0~) but it is not going to be installed
       Depends: node-boxen (>= 1.2.1~) but it is not going to be installed
       Depends: node-import-lazy but it is not going to be installed
       Depends: node-is-npm (>= 1.0~) but it is not going to be installed
       Depends: node-latest-version (>= 3.0~) but it is not going to be installed
       Depends: node-semver-diff (>= 2.0~) but it is not going to be installed
       Depends: node-xdg-basedir (>= 3.0~) but it is not going to be installed
       Depends: node-validate-npm-package-name (>= 3.0~) but it is not going to be installed
       Depends: node-which (>= 1.3~) but it is not going to be installed
       Depends: node-wrappy (>= 1.0.2~) but it is not going to be installed
       Depends: node-write-file-atomic (>= 2.3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

标签: npmdebian

解决方案


这解决了:

curl -L https://npmjs.org/install.sh | sudo sh

推荐阅读