0

I cannot get this thing to work. I was following these instructions from digitalocean:

How To Install Node.js on Ubuntu 22.04

Then, I am getting this error messages:

sudo apt install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/28.3 MB of archives.
After this operation, 179 MB of additional disk space will be used.
(Reading database ... 332991 files and directories currently installed.)
Preparing to unpack .../nodejs_18.7.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (18.7.0-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_18.7.0-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_18.7.0-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I found this article:

Upgrading nodejs on Ubuntu: How to fix broken pipe error?

But its an older version of Ubuntu. I need some help to perform this project.

  • Does this answer your question? dpkg error: "trying to overwrite file, which is also in...". Perhaps you did not clean up some previous attempt to install Node, and the remainders of that attempt is blocking your current attempt. Many people make that mistake once. – user535733 Aug 06 '22 at 02:05
  • @user535733 sudo apt remove nodejs npm does not uninstall the older versions of nodejs? Should I run sudo apt purge nodejs* and sudo apt purge npm* – krillavilla Aug 06 '22 at 02:52
  • @user535733 wouldnt force sudo dpkg -i --force-overwrite <file-path> break my system? in my case sudo dpkg -i --force-overwrite /usr/share/systemtap/tapset/node.stp – krillavilla Aug 06 '22 at 02:56
  • You don't need to purge using wildcards (that's dangerous!). Your output clearly tells you exactly which package needs to be removed. It's possible that --force-overwrite might break your system. You should read the other answers, too, before making a decision. – user535733 Aug 06 '22 at 02:58
  • @user535733 I have tried overwrite and this what I get: – krillavilla Aug 06 '22 at 02:59
  • krillavilla@OMEN:~$ sudo dpkg -i --force-overwrite /usr/share/systemtap/tapset/node.stp dpkg-deb: error: '/usr/share/systemtap/tapset/node.stp' is not a Debian format archive dpkg: error processing archive /usr/share/systemtap/tapset/node.stp (--install): dpkg-deb --control subprocess returned error exit status 2 Errors were encountered while processing: /usr/share/systemtap/tapset/node.stp – krillavilla Aug 06 '22 at 03:00
  • That output is expected, since your command was very wrong. DON'T leap to try the first thing you read -- that's how folks break their systems. This is NOT the kind of problem amenable to a magic incantation. It's actually very simple if you take a few minutes and understand the problem. – user535733 Aug 06 '22 at 03:01
  • @user535733 I apology for rushing. I just want to get this project out the way. – krillavilla Aug 06 '22 at 03:17
  • I got confliced packages coming from libnode72 which was older version amd64:12.22. I had to remove it first before installing Nodjs newer version – krillavilla Aug 06 '22 at 03:20
  • Hooray! You got it! Well done. – user535733 Aug 06 '22 at 03:30

0 Answers0