$ sudo apt-get install npm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
gyp libjs-inherits libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libnode-dev libuv1-dev node-abbrev node-agent-base node-ajv
node-ansi node-ansi-regex node-ansi-styles node-ansistyles node-aproba node-archy node-are-we-there-yet node-asap node-asn1
node-assert-plus node-asynckit node-aws-sign2 node-aws4 node-balanced-match node-bcrypt-pbkdf node-brace-expansion node-builtins
node-cacache node-caseless node-chalk node-chownr node-clone node-color-convert node-color-name node-colors node-columnify
node-combined-stream node-concat-map node-console-control-strings node-copy-concurrently node-core-util-is node-dashdash node-debug
node-defaults node-delayed-stream node-delegates node-depd node-ecc-jsbn node-encoding node-err-code node-escape-string-regexp
node-extend node-extsprintf node-fast-deep-equal node-forever-agent node-form-data node-fs-write-stream-atomic node-fs.realpath
node-function-bind node-gauge node-getpass node-glob node-graceful-fs node-gyp node-har-schema node-har-validator node-has-flag
node-has-unicode node-hosted-git-info node-http-signature node-https-proxy-agent node-iconv-lite node-iferr node-imurmurhash
node-indent-string node-inflight node-inherits node-ini node-ip node-ip-regex node-is-typedarray node-isarray node-isexe node-isstream
node-jsbn node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify node-json-stringify-safe
node-jsonify node-jsonparse node-jsonstream node-jsprim node-leven node-lockfile node-lru-cache node-mime node-mime-types
node-minimatch node-mkdirp node-move-concurrently node-ms node-mute-stream node-nopt node-normalize-package-data node-npm-bundled
node-npm-package-arg node-npmlog node-number-is-nan node-oauth-sign node-object-assign node-once node-opener node-osenv node-p-map
node-path-is-absolute node-performance-now node-process-nextick-args node-promise-inflight node-promise-retry node-promzard node-psl
node-puka node-punycode node-qs node-read node-read-package-json node-readable-stream node-request node-resolve node-resolve-from
node-retry node-rimraf node-run-queue node-safe-buffer node-semver node-set-blocking node-signal-exit node-slash node-spdx-correct
node-spdx-exceptions node-spdx-expression-parse node-spdx-license-ids node-sshpk node-ssri node-string-decoder node-string-width
node-strip-ansi node-supports-color node-tar node-text-table node-through node-tough-cookie node-tunnel-agent node-tweetnacl
node-typedarray-to-buffer node-unique-filename node-universalify node-uri-js node-util-deprecate node-uuid
node-validate-npm-package-license node-validate-npm-package-name node-verror node-wcwidth.js node-which node-wide-align node-wrappy
node-write-file-atomic node-yallist
The following NEW packages will be installed:
gyp libjs-inherits libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libnode-dev libuv1-dev node-abbrev node-agent-base node-ajv
node-ansi node-ansi-regex node-ansi-styles node-ansistyles node-aproba node-archy node-are-we-there-yet node-asap node-asn1
node-assert-plus node-asynckit node-aws-sign2 node-aws4 node-balanced-match node-bcrypt-pbkdf node-brace-expansion node-builtins
node-cacache node-caseless node-chalk node-chownr node-clone node-color-convert node-color-name node-colors node-columnify
node-combined-stream node-concat-map node-console-control-strings node-copy-concurrently node-core-util-is node-dashdash node-debug
node-defaults node-delayed-stream node-delegates node-depd node-ecc-jsbn node-encoding node-err-code node-escape-string-regexp
node-extend node-extsprintf node-fast-deep-equal node-forever-agent node-form-data node-fs-write-stream-atomic node-fs.realpath
node-function-bind node-gauge node-getpass node-glob node-graceful-fs node-gyp node-har-schema node-har-validator node-has-flag
node-has-unicode node-hosted-git-info node-http-signature node-https-proxy-agent node-iconv-lite node-iferr node-imurmurhash
node-indent-string node-inflight node-inherits node-ini node-ip node-ip-regex node-is-typedarray node-isarray node-isexe node-isstream
node-jsbn node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify node-json-stringify-safe
node-jsonify node-jsonparse node-jsonstream node-jsprim node-leven node-lockfile node-lru-cache node-mime node-mime-types
node-minimatch node-mkdirp node-move-concurrently node-ms node-mute-stream node-nopt node-normalize-package-data node-npm-bundled
node-npm-package-arg node-npmlog node-number-is-nan node-oauth-sign node-object-assign node-once node-opener node-osenv node-p-map
node-path-is-absolute node-performance-now node-process-nextick-args node-promise-inflight node-promise-retry node-promzard node-psl
node-puka node-punycode node-qs node-read node-read-package-json node-readable-stream node-request node-resolve node-resolve-from
node-retry node-rimraf node-run-queue node-safe-buffer node-semver node-set-blocking node-signal-exit node-slash node-spdx-correct
node-spdx-exceptions node-spdx-expression-parse node-spdx-license-ids node-sshpk node-ssri node-string-decoder node-string-width
node-strip-ansi node-supports-color node-tar node-text-table node-through node-tough-cookie node-tunnel-agent node-tweetnacl
node-typedarray-to-buffer node-unique-filename node-universalify node-uri-js node-util-deprecate node-uuid
node-validate-npm-package-license node-validate-npm-package-name node-verror node-wcwidth.js node-which node-wide-align node-wrappy
node-write-file-atomic node-yallist npm
0 upgraded, 172 newly installed, 0 to remove and 2 not upgraded.
Need to get 3,713 kB of archives.
After this operation, 15.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Absolutely not! What is all this?
Abort.
这有太多依赖项了。安装时总是这样吗?npm? 为什么或者为什么不?
答案1
npm
还会安装推荐的软件包,其数量可以减少。
我引用了该帖子的答案 为什么 NPM 要安装这么多包?
您可以通过提供以下内容来减少已安装软件包的数量
--no-install-recommends
:
sudo apt-get install npm --no-install-recommends
最小 20.04 LTS 系统的比较:
sudo apt-get install npm
升级了 0 个,新安装了 516 个,删除了 0 个,并且未升级 0 个。
sudo apt-get install npm --no-install-recommends
升级了 0 个,新安装了 313 个,删除了 0 个,并且未升级 0 个。
请注意,该参数的有效性--no-install-recommends
取决于 npm 包如何为您的发行版构建。在某些发行版中,它不起作用。