0

Im trying to install NodeJS version 14 On Ubuntu 22.04.2LTS but this error pops up

dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

Here's the Full log if anyone needs it:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp javascript-common libdevmapper1.02.1:i386 libefiboot1:i386
  libefivar1:i386 libjs-events libjs-highlight.js libjs-inherits
  libjs-is-typedarray libjs-psl libjs-source-map libjs-sprintf-js
  libjs-typedarray-to-buffer libnode-dev libnode72 libssl-dev libuv1-dev
  node-abbrev node-ansi-regex node-ansi-styles node-ansistyles
  node-are-we-there-yet node-arrify node-asap node-asynckit
  node-balanced-match node-brace-expansion node-chownr node-clean-yaml-object
  node-color-convert node-color-name node-commander node-core-util-is
  node-decompress-response node-delayed-stream node-delegates node-depd
  node-diff node-encoding node-end-of-stream node-err-code
  node-escape-string-regexp node-fancy-log node-foreground-child
  node-fs.realpath node-function-bind node-get-stream node-glob node-growl
  node-has-flag node-has-unicode node-hosted-git-info node-iconv-lite
  node-iferr node-imurmurhash node-indent-string node-inflight node-inherits
  node-ini node-ip node-ip-regex node-is-buffer node-is-plain-obj
  node-is-typedarray node-isarray node-isexe node-json-parse-better-errors
  node-jsonparse node-kind-of node-lodash-packages node-lowercase-keys
  node-lru-cache node-mimic-response node-minimatch node-minimist
  node-minipass node-mute-stream node-negotiator node-npm-bundled node-once
  node-osenv node-p-cancelable node-p-map node-path-is-absolute
  node-process-nextick-args node-promise-inflight node-promise-retry
  node-promzard node-pump node-quick-lru node-read node-readable-stream
  node-resolve node-retry node-safe-buffer node-set-blocking node-signal-exit
  node-slash node-slice-ansi node-source-map node-spdx-correct
  node-spdx-exceptions node-spdx-expression-parse node-spdx-license-ids
  node-sprintf-js node-stealthy-require node-string-decoder
  node-supports-color node-text-table node-time-stamp node-tmatch
  node-typedarray-to-buffer node-universalify node-util-deprecate
  node-validate-npm-package-license node-webidl-conversions node-whatwg-fetch
  node-wrappy node-yallist
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 114 not upgraded.
Need to get 0 B/25.4 MB of archives.
After this operation, 121 MB of additional disk space will be used.
(Reading database ... 255398 files and directories currently installed.)
Preparing to unpack .../nodejs_14.21.3-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.21.3-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_14.21.3-deb-1nodes
ource1_amd64.deb (--unpack):
 trying to overwrite '/usr/include/node/common.gypi', which is also in package l
ibnode-dev 12.22.9~dfsg-1ubuntu3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_14.21.3-deb-1nodesource1_amd64.deb```
karel
  • 114,770

1 Answers1

0

Solution

When installing node I highly recommend, installing it with nvm (Node version manager). This makes it easy to install a certain version from node with the associated npm. It also makes switching between node versions very easy.

Install nvm

U can find nvm here: https://github.com/nvm-sh/nvm.

Run: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

This wil create a .nvm directory in your home and tries to update your .bashrc.

See the documentation if you don't use bash almost everything is supported.

Installing node with nvm

Re-open your terminal so that the nvm script is used.

Install your node version:
nvm install 14

Select your node version:
nvm use 14

If you want to check for an specific version run:
nvm ls-remote

Node is installed

Now your version of node is installed with its associated npm version. Every node version has its own node_modules. That means that globally installed npm packages are only for that node version you installed it with.

If you want to switch between node versions just install a new version like nvm install lts and switch with nvm use lts.

If you want more information be sure to check out the README.md on their github.

Jan
  • 1