skip to Main Content

I am facing an issue when trying to install nodejs. When checking the error it requires to upgrade libc6 but I cannot find any way to upgrade libc6 for Ubuntu 18.04.

The old nodejs version I have already uninstalled it with the following commands

sudo apt-get remove nodejs
sudo apt-get remove npm

Issue

    sudo apt-get install -y nodejs
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     nodejs : Depends: libc6 (>= 2.28) but 2.27-3ubuntu1.6 is to be installed
    E: Unable to correct problems, you have held broken packages.

I have gone through these link & link2 & link3 but I didn’t get any help

3

Answers


  1. Chosen as BEST ANSWER

    I have fixed the issue by using an older version of the node. To fix this issue for the latest version of node it requires Ubuntu upgrade

    curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
    sudo apt-get install -y nodejs 
    

  2. first update the repo sources

    sudo apt-get update
    

    Then, install the packages using the command

    sudo apt-get install packagename
    

    Once the package determines that you have some missing dependencies,run the following command to fix broken or missing dependencies.

    sudo apt-get install -f
    
    Login or Signup to reply.
  3. if you want to install the node version with any version with multiple versions. all in one solution and without any error.
    run below commands.

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

    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"

    source ~/.bashrc

    nvm -v
    nvm install v14 <requier version like 14,16,18,>

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search