How to fix npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found in npm
This error occurs when a prebuilt native Node.js module requires a newer version of glibc than your Linux system provides. Solutions include upgrading your OS, using a different Node.js version, or building from source.
Quick fix
Fixes npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found
ldd --version- Check your current glibc version
- Upgrade your operating system (recommended)
- Try a different package version
- Force build from source
ldd --versionnpm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found
What this error means
This error indicates a fundamental incompatibility between a prebuilt binary and your Linux system's C library (glibc). Many npm packages include prebuilt binaries to speed up installation. These binaries are compiled against a specific glibc version. If your system has an older glibc, the binary won't run because newer glibc symbols are missing. glibc is the GNU C Library - a core system component that almost all Linux software depends on. You cannot simply upgrade glibc without potentially breaking your entire system, making this a challenging error to resolve.
Typical symptoms
- npm install succeeds but package fails at runtime with GLIBC error
- Error mentions specific GLIBC version like GLIBC_2.28, GLIBC_2.29, etc.
- Occurs on older Linux distributions (e.g., CentOS 7, Ubuntu 16.04/18.04)
- Affects packages with prebuilt binaries like sharp, canvas, sqlite3
- Works fine on newer systems or macOS/Windows
Common causes
- Running on an older Linux distribution with outdated glibc
- Using a Docker image based on an old base (e.g., node:14-stretch)
- CI/CD environment uses an older OS image
- Package maintainer built binaries on a newer system
- Enterprise environment locked to older RHEL/CentOS versions
How to fix "npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found"
First, determine what glibc version you have:
ldd --versionor
/lib/x86_64-linux-gnu/libc.so.6Common versions: Ubuntu 18.04 has 2.27, Ubuntu 20.04 has 2.31, CentOS 7 has 2.17.
The most reliable fix is upgrading to a newer OS version:
Ubuntu:
sudo do-release-upgradeFor Docker, use a newer base image:
# Instead of node:18-buster, use:
FROM node:18-bullseye
# Or even newer:
FROM node:20-bookwormOlder versions of the package may have binaries built for older glibc:
npm install sharp@0.29.0 # Try older versionsCheck the package's release notes for glibc requirements.
Some packages can rebuild from source with your system's glibc:
npm install --build-from-sourceThis requires build tools:
# Ubuntu/Debian
sudo apt-get install build-essential python3
# CentOS/RHEL
sudo yum groupinstall "Development Tools"If you can't upgrade the host OS, run your app in a container:
docker run -it --rm node:20 npm install your-packageFor production, build and run inside a modern container.
Advanced notes
Do NOT attempt to manually upgrade glibc - it's a core system library and upgrading it incorrectly can render your system unbootable.
For CentOS 7 specifically, which is stuck on glibc 2.17, options are limited:
- Migrate to Rocky Linux 9 or AlmaLinux 9
- Use Software Collections (SCL) for newer toolchains
- Run Node.js apps in containers
Some packages provide multiple prebuilt binaries. For example, sharp offers:
- sharp-linux-x64 - for glibc systems
- sharp-linuxmusl-x64 - for Alpine/musl systems
Check if the package has specific installation instructions for older systems.
Frequently asked questions
- What does "npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28'" mean?
- This error indicates a fundamental incompatibility between a prebuilt binary and your Linux system's C library (glibc). Many npm packages include prebuilt binaries to speed up installation. These binaries are compiled against a specific glibc version.
- How do I fix "npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28'"?
- This error occurs when a prebuilt native Node.js module requires a newer version of glibc than your Linux system provides. Solutions include upgrading your OS, using a different Node.js version, or building from source.
- What causes "npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28'"?
- Running on an older Linux distribution with outdated glibc Using a Docker image based on an old base (e.g., node:14-stretch) CI/CD environment uses an older OS image
- Is the "npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28'" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐npm Official Documentation
- ๐Docs: npm install(Official Docs)
- ๐ฌSO: GLIBC version mismatch(Stack Overflow)
- ๐GitHub: node GLIBC compatibility(GitHub)