I running node -v command getting error:- node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
Any solution
I running node -v command getting error:- node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
Any solution
Finally I got solution by running by running following commands.
sudo apt-get remove nodejs
nvm install 16.15.1
node v16.15.1 version and npm v16.15.1 is installed. For same make sure nvm is installed in your machine.
you can install node v17.x by nvm(nodejs version manager).
my OS version: Ubuntu 18.04.6 LTS
I tried three ways to install node and npm in my pc:
(fail) apt-get, the version is very old
$ sudo apt-get install nodejs
$ sudo apt-get install npm
$ node -v
v8.10.0
$ npm -v
6.1.0
(fail) script from source code of nodejs, only node is updated, npm is not. https://github.com/nodesource/distributions/blob/master/README.md#using-ubuntu-1
$ curl -sL https://deb.nodesource.com/setup_14.x -o /tmp/nodesource14_setup.sh
$ node -v
v14.20.1
$ npm -v
6.1.0
(success) use nvm
https://github.com/nvm-sh/nvm#installing-and-updating
$ sudo apt-get remove nodejs
$ sudo apt-get remove npm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
$ chmod +x ~/.nvm/nvm.sh
$ source ~/.bashrc
$ nvm -v
0.39.2
$ nvm install 14
$ node -v
v14.20.1
$ npm -v
6.14.17
$ nvm install 16
$ node -v
v16.18.0
$ npm -v
8.19.2
$ nvm install 17
$ node -v
v17.9.1
$ npm -v
8.11.0
# failed to install 18
$ nvm install 18
$ node -v
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
$ npm -v
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
You got the issue because node version is not compatible with ubuntu. IN my case, I got the same issue with Ubuntu 18 & Node 16.15.1.
Using this command to check GLIBC version
ldd --version
My version is 2.27. So I has tried to fix by change the nodejs version.
sudo apt-get remove nodejs
nvm install 14.17.6
I'd had the same problem when installing Node with versions greater than or equal 18.
My solution was upgrade my distribution Ubuntu to version 20.04, followings the steps:
if you don't use WSL you can skip the steps:
wsl --shutdown
wsl-backup
with the command mkdir C:\wsl-backup\
.wsl --export Ubuntu-18.04 C:\wsl-backup\ubuntu-18.04.tar
.If there is a problem in the process, you can restore your WSL using the command
mkdir C:\WSL
andwsl --import Ubuntu-18.04 C:\WSL C:\wsl-backup\ubuntu-18.04.tar
to recover.
For me it was necessary to remove the
snapd
package, because ubuntu was not allowing me to upgrade to 20.04 LTS version
sudo apt purge snapd
sudo apt update
sudo apt list --upgradable
sudo apt upgrade -y
update-manger-core
package:It’s essential to install this update manager core package this will trick the system into thinking there is a new LTS available and allow you to do an in-place upgrade.
sudo apt install update-manager-core
sudo do-release-upgrade
if you are using an LTS version (recommended) and found that there is no new LTS version available it will show this message
Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS development release
set Prompt=normal in /etc/update-manager/release-upgrades.
If it's not relevant to you to not use LTS versions, you can change the Prompt to normal in /etc/update-manager/release-upgrades file and rerun the previous command.
sudo do-release-upgrade -d
During installation, will need your interaction to allow installation of the additional packages that come in version 20.04 (Including lib6 that is required by node).
Finished, now can verify your distribution version ubuntu using the command:
lsb_release -a
You should get an output similar to this
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
Now you can use node version >=18
Installing node LTS
In the current date (26/nov/2022) is v18
nvm install lts
# or nvm install --lts
Use LTS version
nvm use lts
Check node version
node -v
# v18.12.1
Upgrade Ubuntu Version on WSL
22.04 LTS "sudo do-release-upgrade" does not work
Can't upgrade to Ubuntu 21.04 : "Restoring original system state. Aborting"
the root cause is the latest node need glibc2.28 but the Ubuntu 18 only includes glic2.27.
Solution: 1. use a lower version node, e.g. "sudo apt-get remove nodejs nvm install 16.15.1". refer to "Abhay Kumar Upadhyay"'s answer.
Solution 2: upgrade glibc to glic2.28+. refer to: https://www.digitalocean.com/community/questions/how-install-glibc-2-29-or-higher-in-ubuntu-18-04
Solution 3: upgrade Ubuntu 18 to 20. refer to "'Hállex da S. Costa"'s answer.
I ended up here after my GitHub Actions build failed with the error:
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
The problem is ubuntu-18.04
not supporting node 18 (as explained [here](node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node))) because of the glibc version bump.
The solution is to update to ubuntu-20.04
or higher.
You likely have a node version installed that is compiled for a different ubuntu release to the one you are running.
I would suggest removing it, then installing the nodesource binary distribution. It should auto-detect your ubuntu release and install the correct node release.
It means the current version of Linux doesn't have GLIBC_2.28 which the latest version of Node requires.
You can run the ldd --version command to check your GLIBC version.
ldd --version
You can fix this in two ways:
Just Changing your node version to 16 is the fastest solution and it worked for me.
nvm install 16
nvm use 16
if You don't have NVM(Node Version Manager) Then Install Using:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
Agree with others to remove and reinstall the nodejs, but if you don't want to uninstall it or you are not sure to remove it, change the version.
nvm use 16
Or any version that works for your test. it worked for me!
As per @ys_sunshine, I had change a few things for Rasberry Pi.
After installing the LTS version as per the following instructions: https://pimylifeup.com/raspberry-pi-nodejs/
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
I got the following error:
$ node -v
node: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.25' not found (required by node)
node: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by node)
This meant I couldn't run anything, so I tried the following:
$ sudo apt-get remove nodejs
$ sudo apt-get remove npm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh > install.sh
$ chmod +x install.sh
$ source ~/.bashrc
$ nvm -v
0.39.2
$ nvm install 14
$ node -v
v14.22.2
$ npm -v
6.14.17
In certain situations where you have moved everything to a new machine and not rebuilt your node_modules this can happen.
In your project folder run this:
npm rebuild
This isn't always the case, but it is possibly this.
Remove note
sudo apt-get remove nodejs
Install NVM on Ubuntu 22.04|20.04|18.04 with the command:
wget https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh
bash install.sh
After the installation, source the profile.
source ~/.bashrc
Verify the NVM installation.
nvm -v
With NVM, you can also list the installed Node.js versions with the command:
nvm install 16.15.1
Switch to a preferred version of Node.js.
nvm use 16
You can as well make the version default.
nvm alias default 16
This issue can be resolved by switching to stable available node version. You can switch to the stable node version with the below command.
nvm install --lts
Then, Use nvm alias default {VERSION}
to switch the version of Node.js used by default when starting a new shell.