Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2325  / 1 Year ago, wed, february 8, 2023, 10:29:24

I just installed Ubuntu 22.04 a few days ago. My laptop is almost entirely blank. So I am met with confusion when I try to install Nodejs using these DigitalOcean instructions and I get an error.


I do:


sudo apt update
sudo apt install nodejs

The second command gives


Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
javascript-common libc-ares2 libjs-highlight.js libnode72
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/26.4 MB of archives.
After this operation, 124 MB of additional disk space will be used.
(Reading database ... 197872 files and directories currently installed.)
Preparing to unpack .../nodejs_16.15.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.15.1-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.15.1-deb-1nodes
ource1_amd64.deb (--unpack):
trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in pa
ckage libnode72:amd64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_16.15.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am new to Ubuntu so I can't read this message, or at least I can't tell what's useful etc.


I found a similar error message using Google here and I followed this instruction on the page.


// Delete the new package source.
cd /etc/apt/sources.list.d
sudo rm nodesource.list

// Update apt, fix the install, remove nodeJS and the nodejs-doc packages.
sudo apt --fix-broken install
sudo apt update
sudo apt remove nodejs
sudo apt remove nodejs-doc

// then use the instructions to install the latest node
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

But that gives me the same or a similar error


sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
javascript-common libc-ares2 libjs-highlight.js libnode72
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/26.4 MB of archives.
After this operation, 124 MB of additional disk space will be used.
(Reading database ... 197872 files and directories currently installed.)
Preparing to unpack .../nodejs_16.15.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.15.1-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.15.1-deb-1nodesource1_amd64.deb (--unpack):
trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:amd64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_16.15.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


Any suggestions? Please & thank you


More From » apt

 Answers
5

From the nodejs version you are trying to install (16.15) it appears that you are not installing nodejs from the Ubuntu 22.04 distribution, where 12.22 is current.


Unless you have a specific reason to install the out-of-distro version, you could just remove the file you added to /etc/apt/sources.list.d/ in order to obtain the 16.15 version, and then run apt update && apt install nodejs to install 12.22.


If you insist on the out-of-distro newer version, first remove the remnants of the Ubuntu default version with apt autoremove (as apt suggests), then try installing again.


[#405] Thursday, February 9, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
skaing

Total Points: 462
Total Questions: 124
Total Answers: 113

Location: Nauru
Member since Thu, Feb 2, 2023
1 Year ago
skaing questions
Thu, Jun 2, 22, 14:45, 2 Years ago
Mon, Apr 10, 23, 17:06, 1 Year ago
Sat, Mar 25, 23, 18:49, 1 Year ago
Fri, Jul 30, 21, 13:04, 3 Years ago
Sat, Apr 16, 22, 14:36, 2 Years ago
;