I tried to update nodejs to the current version and it broke the version I had installed, so I ran "sudo apt --fix-broken install" and that did not fix it so then I used sudo apt autoremove nodejs and it said that nodejs had dependencies and that I could not remove it.
I am running the latest non-lts release of ubuntu (21.10)
This is also a fresh install of ubuntu except for apache2 and visual studio code
This is the output of when I ran "sudo apt --fix-broken install":
EXAMPLE@EXAMPLE:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi gyp javascript-common
libc-ares2 libgstreamer-plugins-bad1.0-0 libjs-highlight.js libjs-inherits
libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libssl-dev
libuv1-dev libva-wayland2 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-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 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 0 not upgraded.
Need to get 0 B/26.5 MB of archives.
After this operation, 178 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 194882 files and directories currently installed.)
Preparing to unpack .../nodejs_17.1.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (17.1.0-deb-1nodesource1) over (12.22.5~dfsg-5ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_17.1.0-deb-1nodeso
urce1_amd64.deb (--unpack):
trying to overwrite '/usr/share/doc/nodejs/api/fs.html', which is also in packa
ge nodejs-doc 12.22.5~dfsg-5ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_17.1.0-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)