Score:0

Error Upgrading Nodejs

cn flag
└─# apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 nodejs : Depends: libnode72 (= 12.21.0~dfsg-5) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When running apt --fix-broken install:

└─# apt --fix-broken install                                              100 ⨯
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:
  libfuse3-3 libjs-highlight.js 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 1133 not upgraded.
Need to get 0 B/26.2 MB of archives.
After this operation, 122 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 413977 files and directories currently installed.)
Preparing to unpack .../nodejs_16.9.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.9.0-deb-1nodesource1) over (12.21.0~dfsg-5) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.9.0-deb-1nodeso
urce1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/doc/nodejs/api/process.html', which is also in 
package nodejs-doc 12.21.0~dfsg-5
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_16.9.0-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
                                                    

What should I do?

guiverc avatar
cn flag
You've provided no OS & release details; knowing this is generally necessary to fix issues. Your package details provided in your post do **not** match any supported OS & release (could be 3rd party, but we cannot know given we don't know your OS & release details).
karel avatar
sa flag
Does this answer your question? [dpkg error: "trying to overwrite file, which is also in..."](https://askubuntu.com/questions/176121/dpkg-error-trying-to-overwrite-file-which-is-also-in)
Score:2
in flag

Very rarely does this happen, but you may need to bring out the big guns for this one:

  1. Open Terminal (if it's not already open)
  2. Force an overwrite for the Node package:
    sudo dpkg -i --force-overwrite /var/cache/apt/archives/nodejs_16.9.0-deb-1nodesource1_amd64.deb
    
  3. Fix the rest of the broken install:
    sudo apt -f install
    
  4. Make sure the rest of your system is properly up to date:
    sudo apt update
    sudo apt dist-upgrade
    

Try not to let things get crazy enough to see messages like:

1 upgraded, 0 newly installed, 0 to remove and 1133 not upgraded.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.