I'm trying to upgrade my NodeJS 12.22.09 to version 16 or newer, but when I enter the command sudo apt update && sudo apt upgrade
it returns this error below:
Preparing to unpack …/12-nodejs_16.16.0-deb-1nodesource1_amd64.deb …
Unpacking nodejs (16.16.0-deb-1nodesource1) over (12.22.9~dfsg-1ubuntu3) …
dpkg: error processing archive /tmp/apt-dpkg-install-hIlTWe/12-nodejs_16.16.0-deb-1nodesource1_amd64.deb (—unpack):
trying to overwrite ‘/usr/include/node/common.gypi’, which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack …/13-snapd_2.56.2+22.04ubuntu1_amd64.deb …
Unpacking snapd (2.56.2+22.04ubuntu1) over (2.55.5+22.04) …
Errors were encountered while processing:
/tmp/apt-dpkg-install-hIlTWe/12-nodejs_16.16.0-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
How to solve this problem?