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
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
first update the repo sources
Then, install the packages using the command
Once the package determines that you have some missing dependencies,run the following command to fix broken or missing dependencies.
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,>