我正在使用 Ubuntu 20.04。我已经使用 安装了 nodejs sudo apt install nodejs
,但在使用时nodejs --version
它要求我安装。然后当我尝试使用它时,sudo apt install npm
它显示以下错误消息:
The following packages have unmet dependencies:
npm : Depends: nodejs (>= 6.11~)
Depends: node-abbrev (>= 1.1.1~) but it is not going to be installed
Depends: node-ajv but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-ansi-regex (>= 3.0~) but it is not going to be installed
Depends: node-ansi-styles but it is not going to be installed
Depends: node-ansistyles but it is not going to be installed
Depends: node-aproba but it is not going to be installed
Depends: node-archy (>= 1.0~) but it is not going to be installed
Depends: node-are-we-there-yet but it is not going to be installed
Depends: node-asap but it is not going to be installed
Depends: node-asn1 but it is not going to be installed
Depends: node-assert-plus but it is not going to be installed
Depends: node-asynckit but it is not going to be installed
Depends: node-aws4 but it is not going to be installed
Depends: node-aws-sign2 but it is not going to be installed
Depends: node-balanced-match but it is not going to be installed
Depends: node-bcrypt-pbkdf but it is not going to be installed
Depends: node-bl but it is not going to be installed
Depends: node-bluebird but it is not going to be installed
Depends: node-boxen but it is not going to be installed
Depends: node-brace-expansion but it is not going to be installed
Depends: node-builtin-modules but it is not going to be installed
Depends: node-builtins but it is not going to be installed
Depends: node-cacache but it is not going to be installed
Depends: node-call-limit but it is not going to be installed
Depends: node-camelcase but it is not going to be installed
Depends: node-caseless but it is not going to be installed
Depends: node-chalk but it is not going to be installed
Depends: node-chownr but it is not going to be installed
Depends: node-ci-info but it is not going to be installed
Depends: node-cli-boxes but it is not going to be installed
Depends: node-cliui but it is not going to be installed
Depends: node-clone but it is not going to be installed
Depends: node-co but it is not going to be installed
Depends: node-color-convert but it is not going to be installed
Depends: node-color-name but it is not going to be installed
Depends: node-colors but it is not going to be installed
Depends: node-columnify but it is not going to be installed
Depends: node-combined-stream but it is not going to be installed
Depends: node-concat-map but it is not going to be installed
Depends: node-concat-stream but it is not going to be installed
Depends: node-config-chain but it is not going to be installed
Depends: node-configstore but it is not going to be installed
Depends: node-console-control-strings but it is not going to be installed
Depends: node-copy-concurrently but it is not going to be installed
Depends: node-core-util-is but it is not going to be installed
Depends: node-cross-spawn but it is not going to be installed
Depends: node-crypto-random-string but it is not going to be installed
Depends: node-cyclist but it is not going to be installed
Depends: node-dashdash but it is not going to be installed
Depends: node-debug but it is not going to be installed
Depends: node-decamelize but it is not going to be installed
Depends: node-deep-extend but it is not going to be installed
Depends: node-defaults but it is not going to be installed
Depends: node-define-properties but it is not going to be installed
Depends: node-delayed-stream but it is not going to be installed
Depends: node-delegates but it is not going to be installed
Depends: node-detect-indent but it is not going to be installed
Depends: node-detect-newline but it is not going to be installed
Depends: node-dot-prop but it is not going to be installed
Depends: node-duplexer3 but it is not going to be installed
Depends: node-duplexify but it is not going to be installed
Depends: node-ecc-jsbn but it is not going to be installed
Depends: node-editor but it is not going to be installed
Depends: node-encoding but it is not going to be installed
Depends: node-end-of-stream but it is not going to be installed
Depends: node-err-code but it is not going to be installed
Depends: node-errno but it is not going to be installed
Depends: node-es6-promise but it is not going to be installed
Depends: node-escape-string-regexp but it is not going to be installed
Depends: node-execa but it is not going to be installed
Depends: node-extend but it is not going to be installed
Depends: node-extsprintf but it is not going to be installed
Depends: node-fast-deep-equal but it is not going to be installed
Depends: node-find-up but it is not going to be installed
Depends: node-flush-write-stream but it is not going to be installed
Depends: node-forever-agent but it is not going to be installed
Depends: node-form-data but it is not going to be installed
Depends: node-from2 but it is not going to be installed
Depends: node-fs.realpath but it is not going to be installed
Depends: node-fs-vacuum but it is not going to be installed
Depends: node-fs-write-stream-atomic but it is not going to be installed
Depends: node-function-bind but it is not going to be installed
Depends: node-gauge but it is not going to be installed
Depends: node-genfun but it is not going to be installed
Depends: node-get-caller-file but it is not going to be installed
Depends: node-getpass but it is not going to be installed
Depends: node-glob (>= 7.1.2~) but it is not going to be installed
Depends: node-got 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-gyp (>= 3.6.2~) but it is not going to be installed
Depends: node-har-schema but it is not going to be installed
Depends: node-har-validator but it is not going to be installed
Depends: node-has-flag but it is not going to be installed
Depends: node-has-unicode 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-http-signature but it is not going to be installed
Depends: node-iconv-lite but it is not going to be installed
Depends: node-iferr but it is not going to be installed
Depends: node-import-lazy but it is not going to be installed
Depends: node-imurmurhash but it is not going to be installed
Depends: node-inflight 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-invert-kv but it is not going to be installed
Depends: node-ip but it is not going to be installed
Depends: node-ip-regex but it is not going to be installed
Depends: node-isarray but it is not going to be installed
Depends: node-isexe but it is not going to be installed
Depends: node-is-npm but it is not going to be installed
Depends: node-is-obj but it is not going to be installed
Depends: node-is-path-inside but it is not going to be installed
Depends: node-is-retry-allowed but it is not going to be installed
Depends: node-is-stream but it is not going to be installed
Depends: node-isstream but it is not going to be installed
Depends: node-is-typedarray but it is not going to be installed
Depends: node-jsbn but it is not going to be installed
Depends: node-jsonparse but it is not going to be installed
Depends: node-json-parse-better-errors but it is not going to be installed
Depends: node-json-schema but it is not going to be installed
Depends: node-json-schema-traverse 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-stringify-safe but it is not going to be installed
Depends: node-jsprim but it is not going to be installed
Depends: node-latest-version but it is not going to be installed
Depends: node-lazy-property but it is not going to be installed
Depends: node-lcid but it is not going to be installed
Depends: node-libnpx but it is not going to be installed
Depends: node-locate-path but it is not going to be installed
Depends: node-lodash but it is not going to be installed
Depends: node-lockfile (>= 1.0.3~) but it is not going to be installed
Depends: node-lowercase-keys 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-make-dir but it is not going to be installed
Depends: node-mem but it is not going to be installed
Depends: node-mime but it is not going to be installed
Depends: node-mime-types but it is not going to be installed
Depends: node-mimic-fn but it is not going to be installed
Depends: node-minimatch but it is not going to be installed
Depends: node-minimist but it is not going to be installed
Depends: node-mississippi but it is not going to be installed
Depends: node-mkdirp (>= 0.5.1~) but it is not going to be installed
Depends: node-move-concurrently but it is not going to be installed
Depends: node-ms but it is not going to be installed
Depends: node-mute-stream 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-npm-bundled but it is not going to be installed
Depends: node-npm-package-arg (>= 6.1.1) but it is not going to be installed
Depends: node-npmlog (>= 4.1.2~) but it is not going to be installed
Depends: node-number-is-nan but it is not going to be installed
Depends: node-oauth-sign but it is not going to be installed
Depends: node-object-assign but it is not going to be installed
Depends: node-once (>= 1.4~) but it is not going to be installed
Depends: node-opener but it is not going to be installed
Depends: node-osenv (>= 0.1.5~) but it is not going to be installed
Depends: node-os-locale but it is not going to be installed
Depends: node-os-tmpdir but it is not going to be installed
Depends: node-package-json but it is not going to be installed
Depends: node-parallel-transform but it is not going to be installed
Depends: node-path-exists but it is not going to be installed
Depends: node-path-is-absolute but it is not going to be installed
Depends: node-path-is-inside but it is not going to be installed
Depends: node-promise-inflight but it is not going to be installed
Depends: node-promise-retry but it is not going to be installed
Depends: node-promzard but it is not going to be installed
Depends: node-performance-now but it is not going to be installed
Depends: node-p-finally but it is not going to be installed
Depends: node-p-is-promise but it is not going to be installed
Depends: node-pify but it is not going to be installed
Depends: node-p-limit but it is not going to be installed
Depends: node-p-locate but it is not going to be installed
Depends: node-prepend-http but it is not going to be installed
Depends: node-process-nextick-args but it is not going to be installed
Depends: node-proto-list but it is not going to be installed
Depends: node-prr but it is not going to be installed
Depends: node-pseudomap but it is not going to be installed
Depends: node-psl but it is not going to be installed
Depends: node-pump but it is not going to be installed
Depends: node-pumpify but it is not going to be installed
Depends: node-punycode but it is not going to be installed
Depends: node-qs but it is not going to be installed
Depends: node-qw but it is not going to be installed
Depends: node-rc but it is not going to be installed
Depends: node-read (>= 1.0.7~) but it is not going to be installed
Depends: node-readable-stream 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-registry-auth-token but it is not going to be installed
Depends: node-registry-url but it is not going to be installed
Depends: node-request (>= 2.83~) but it is not going to be installed
Depends: node-require-main-filename but it is not going to be installed
Depends: node-require-directory but it is not going to be installed
Depends: node-resolve-from (>= 4.0~) 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-run-queue but it is not going to be installed
Depends: node-safe-buffer but it is not going to be installed
Depends: node-semver (>= 5.5~) but it is not going to be installed
Depends: node-set-blocking but it is not going to be installed
Depends: node-sha (>= 2.0.1~) but it is not going to be installed
Depends: node-shebang-command but it is not going to be installed
Depends: node-shebang-regex but it is not going to be installed
Depends: node-signal-exit 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 but it is not going to be installed
Depends: node-slash but it is not going to be installed
Depends: node-semver-diff but it is not going to be installed
Depends: node-spdx-correct but it is not going to be installed
Depends: node-spdx-exceptions but it is not going to be installed
Depends: node-spdx-expression-parse but it is not going to be installed
Depends: node-spdx-license-ids but it is not going to be installed
Depends: node-sshpk but it is not going to be installed
Depends: node-ssri but it is not going to be installed
Depends: node-stream-each but it is not going to be installed
Depends: node-stream-iterate but it is not going to be installed
Depends: node-stream-shift but it is not going to be installed
Depends: node-strict-uri-encode but it is not going to be installed
Depends: node-string-decoder but it is not going to be installed
Depends: node-string-width but it is not going to be installed
Depends: node-strip-ansi (>= 4.0~) but it is not going to be installed
Depends: node-strip-json-comments but it is not going to be installed
Depends: node-strip-eof but it is not going to be installed
Depends: node-supports-color but it is not going to be installed
Depends: node-tar (>= 4.4~) but it is not going to be installed
Depends: node-term-size but it is not going to be installed
Depends: node-text-table but it is not going to be installed
Depends: node-through but it is not going to be installed
Depends: node-through2 but it is not going to be installed
Depends: node-timed-out but it is not going to be installed
Depends: node-tough-cookie but it is not going to be installed
Depends: node-tunnel-agent but it is not going to be installed
Depends: node-tweetnacl but it is not going to be installed
Depends: node-typedarray but it is not going to be installed
Depends: node-uid-number but it is not going to be installed
Depends: node-unique-filename but it is not going to be installed
Depends: node-unique-string but it is not going to be installed
Depends: node-unpipe but it is not going to be installed
Depends: node-url-parse-lax but it is not going to be installed
Depends: node-util-deprecate but it is not going to be installed
Depends: node-uuid but it is not going to be installed
Depends: node-validate-npm-package-name but it is not going to be installed
Depends: node-verror but it is not going to be installed
Depends: node-which (>= 1.3~) but it is not going to be installed
Depends: node-which-module but it is not going to be installed
Depends: node-wide-align but it is not going to be installed
Depends: node-widest-line but it is not going to be installed
Depends: node-wrap-ansi but it is not going to be installed
Depends: node-wrappy but it is not going to be installed
Depends: node-wcwidth.js but it is not going to be installed
Depends: node-write-file-atomic but it is not going to be installed
Depends: node-xdg-basedir but it is not going to be installed
Depends: node-xtend but it is not going to be installed
Depends: node-yargs but it is not going to be installed
Depends: node-yargs-parser but it is not going to be installed
Depends: node-yallist but it is not going to be installed
Depends: node-y18n but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我尝试使用 aptitude 和 nvm 安装,但没有任何效果。
答案1
这是我将尽力做出贡献的一点:
首先,检查版本的命令应该是:
~$ node --version
而不是。这样做你会在终端上
nodejs --version
看到一些格式;v12.20.1
我建议您完全卸载
nodejs
并重新启动该过程。
之后,要安装,npm
请先尝试运行更新,然后安装 npm:~$ sudo apt-get update ~$ sudo apt-get install npm
或者,
sudo aptitude
命令将是最好的。
检查以npm --version
查看格式;6.14.10
。
我建议的另一种方法是您可以安装并使用
synaptic package manager
。~$ sudo apt-get install synaptic
我希望这对你确实有帮助!