dpkg-deb: 错误:粘贴子进程被信号(管道破裂)终止 nodejs

我已经尝试了网上许多不同网站提供的各种解决方案。 我首先运行:sudo apt upgrade,然后再运行:sudo apt upgrade,但是正如你所看到的,最终出现了无法满足的依赖关系。
michael@Ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.18.2~dfsg-1ubuntu2) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

To fix the unmet dependencies I run:  sudo apt --fix-broken install:
michael@Ubuntu:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libjs-inherits libjs-is-typedarray libjs-psl
  libjs-typedarray-to-buffer libssl-dev libuv1-dev node-abbrev node-ajv
  node-ansi node-ansi-align 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-bl node-bluebird node-boxen node-brace-expansion
  node-builtin-modules node-builtins node-cacache node-call-limit
  node-camelcase node-caseless node-chalk node-chownr node-ci-info
  node-cli-boxes node-cliui node-clone node-co node-color-convert
  node-color-name node-colors node-columnify node-combined-stream
  node-concat-map node-concat-stream node-config-chain node-configstore
  node-console-control-strings node-copy-concurrently node-core-util-is
  node-cross-spawn node-crypto-random-string node-cyclist node-dashdash
  node-debbundle-es-to-primitive node-debug node-decamelize
  node-decompress-response node-deep-extend node-defaults
  node-define-properties node-delayed-stream node-delegates node-detect-indent
  node-detect-newline node-dot-prop node-duplexer3 node-duplexify
  node-ecc-jsbn node-editor node-encoding node-end-of-stream node-err-code
  node-errno node-es6-promise node-escape-string-regexp node-execa node-extend
  node-extsprintf node-fast-deep-equal node-find-up node-flush-write-stream
  node-forever-agent node-form-data node-from2 node-fs-vacuum
  node-fs-write-stream-atomic node-fs.realpath node-function-bind node-gauge
  node-genfun node-get-caller-file node-get-stream node-getpass node-glob
  node-got node-graceful-fs node-har-schema node-har-validator node-has-flag
  node-has-symbol-support-x node-has-to-string-tag-x node-has-unicode
  node-hosted-git-info node-http-signature node-iconv-lite node-iferr
  node-import-lazy node-imurmurhash node-inflight node-inherits node-ini
  node-invert-kv node-ip node-ip-regex node-is-npm node-is-obj node-is-object
  node-is-path-inside node-is-plain-obj node-is-retry-allowed node-is-stream
  node-is-typedarray node-isarray node-isexe node-isstream node-isurl
  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-latest-version node-lazy-property node-lcid node-libnpx
  node-locate-path node-lockfile node-lodash node-lodash-packages
  node-lowercase-keys node-lru-cache node-make-dir node-mem node-mime
  node-mime-types node-mimic-fn node-mimic-response node-minimatch
  node-minimist node-mississippi node-mkdirp node-move-concurrently node-ms
  node-mute-stream node-nopt node-normalize-package-data node-npm-bundled
  node-npm-package-arg node-npm-run-path node-npmlog node-number-is-nan
  node-oauth-sign node-object-assign node-once node-opener node-os-locale
  node-os-tmpdir node-osenv node-p-cancelable node-p-finally node-p-is-promise
  node-p-limit node-p-locate node-p-timeout node-package-json
  node-parallel-transform node-path-exists node-path-is-absolute
  node-path-is-inside node-performance-now node-pify node-prepend-http
  node-process-nextick-args node-promise-inflight node-promise-retry
  node-promzard node-proto-list node-prr node-pseudomap node-psl node-pump
  node-pumpify node-punycode node-qs node-qw node-rc node-read
  node-read-package-json node-readable-stream node-registry-auth-token
  node-registry-url node-request node-require-directory
  node-require-main-filename node-resolve node-resolve-from node-retry
  node-rimraf node-run-queue node-safe-buffer node-semver node-semver-diff
  node-set-blocking node-sha node-shebang-command node-shebang-regex
  node-signal-exit node-slash node-slide node-sorted-object node-spdx-correct
  node-spdx-exceptions node-spdx-expression-parse node-spdx-license-ids
  node-sshpk node-ssri node-stream-each node-stream-iterate node-stream-shift
  node-strict-uri-encode node-string-decoder node-string-width node-strip-ansi
  node-strip-eof node-strip-json-comments node-supports-color node-tar
  node-term-size node-text-table node-through node-through2 node-timed-out
  node-tough-cookie node-tunnel-agent node-tweetnacl node-typedarray
  node-typedarray-to-buffer node-uid-number node-unique-filename
  node-unique-string node-unpipe node-uri-js node-url-parse-lax
  node-url-to-options node-util-deprecate node-uuid
  node-validate-npm-package-license node-validate-npm-package-name node-verror
  node-wcwidth.js node-which node-which-module node-wide-align
  node-widest-line node-wrap-ansi node-wrappy node-write-file-atomic
  node-xdg-basedir node-xtend node-y18n node-yallist node-yargs
  node-yargs-parser nodejs-doc
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  nodejs
The following packages will be upgraded:
  nodejs
1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/18.4 MB of archives.
After this operation, 94.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 193811 files and directories currently installed.)
Preparing to unpack .../nodejs_12.20.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (12.20.0-deb-1nodesource1) over (12.18.2~dfsg-1ubuntu2) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_12.20.0-deb-1nodes
ource1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/doc/nodejs/api/perf_hooks.html', which is also 
in package nodejs-doc 12.18.2~dfsg-1ubuntu2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_12.20.0-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我遇到了破管错误。这是一个恶性循环。我无法用正确的答案打破它。所以,请善良的人帮助我,给我一些见解。 提前感谢。
2个回答

你可以尝试通过打开终端(通常是Ctrl + Alt + T)并从那里执行来解决它。
sudo dpkg -i --force-overwrite /var/cache/apt/archives/nodejs_12.20.0-deb-1nodesource1_amd64.deb

然后

sudo apt -f install

取决于: libnode72 (= 12.18.2~dfsg-1ubuntu2),因此这可能只是用版本不匹配的方式替换覆盖失败。 - user535733

你的问题在你的输出中似乎已经清楚地表达出来了。
dpkg: error processing archive /var/cache/apt/archives/nodejs_12.20.0-deb-1nodes ource1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/doc/nodejs/api/perf_hooks.html', which is also in package nodejs-doc 12.18.2~dfsg-1ubuntu2 

让我们把这个拆解开,这样就容易阅读了:
A = nodejs_12.20.0-deb-1nodesource1_amd64.deb
B = nodejs-doc 12.18.2~dfsg-1ubuntu2

dpkg: error processing A (--unpack):
 trying to overwrite '/usr/share/doc/nodejs/api/perf_hooks.html', which is also in B

换句话说,包 A 和包 B 产生了冲突。你不能同时安装两个。一次只能安装一个。

A 和 B 来自不同的源,并且是不同的版本(这也行不通)。

出现问题是因为你不明智地混合了不同的源。选择一个统一的源来安装你的节点包...并坚持使用它。


如何在终端中删除旧的软件包? - undefined
@Avatar先修复源代码以消除冲突。 - undefined