
Let's say something like this is being returned when using the Node.js CLI.
~]$ node --version
node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
This should mean that the /usr/lib64/libc.so.6 library file is not symbolically linked to the version of GNU C Library being returned in the error message. In this example, the /usr/lib64/libc.so.6 library file is symbolically linked to version 2.26 of GNU C Library.
~]$ ll /usr/lib64 | grep -i libc-
-rwxr-xr-x 1 root root 2030048 Nov 27 21:58 libc-2.26.so
lrwxrwxrwx 1 root root 12 Dec 22 05:08 libc.so.6 -> libc-2.26.so
Likewise the ldd command can be used to display the version of GNU C Library being used by the Operating System.
~]$ ldd --version
ldd (GNU libc) 2.26
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
There are a few options here.
- Downgrade to an earlier version of Node.js that is compatible with the version of GNU C Library on your system
- Compile GNU C Library and then patch Node.js to use the compiled version of GNU C Library
- Upgrade your Linux Operating System to a version that has the version of GNU C Library that Node.js requires
If you are going to Compile GNU C Library and then patch Node.js to use the compiled version of GNU C Library, check out my article FreeKB - GNU C Library - Compile GNU C Library from source on Linux. Let's say you were able to make /usr/lib64/libc-2.28.so.
The node CLI is an ELF executable so the PatchELF CLI can be used to modify the node CLI.
~]$ file ~/.nvm/versions/node/v20.18.1/bin/node
/home/c065234/.nvm/versions/node/v20.18.1/bin/node: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=ba383b67f252e474714af4036dd199a92ae460a7, for GNU/Linux 3.2.0, with debug_info, not stripped, too many notes (256)
Let's download and setup the PatchELF CLI. Check out my article Download and setup the PatchELF CLI.
And then use patchelf to update Node.js to use a specific version of GNU C Library.
patchelf \
--set-interpreter /usr/local/glibc-2.27/lib/ld-linux-x86-64.so.2 \
--set-rpath /usr/local/glibc-2.27/lib:/usr/lib64:/lib64 \
/usr/local/bin/node
Did you find this article helpful?
If so, consider buying me a coffee over at