How to fix npm ERR! Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found in npm

npmADVANCEDHIGHUpdated Dec 3, 2025ยท 118 views

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
  1. Check your current glibc version
  2. Upgrade your operating system (recommended)
  3. Try a different package version
  4. Force build from source
npm โ€” error
ldd --version
npm 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

  1. Running on an older Linux distribution with outdated glibc
  2. Using a Docker image based on an old base (e.g., node:14-stretch)
  3. CI/CD environment uses an older OS image
  4. Package maintainer built binaries on a newer system
  5. 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"

1Check your current glibc version

First, determine what glibc version you have:

bash
ldd --version

or

bash
/lib/x86_64-linux-gnu/libc.so.6

Common versions: Ubuntu 18.04 has 2.27, Ubuntu 20.04 has 2.31, CentOS 7 has 2.17.

2Upgrade your operating system (recommended)

The most reliable fix is upgrading to a newer OS version:

Ubuntu:

bash
sudo do-release-upgrade

For Docker, use a newer base image:

dockerfile
# Instead of node:18-buster, use:
FROM node:18-bullseye
# Or even newer:
FROM node:20-bookworm
3Try a different package version

Older versions of the package may have binaries built for older glibc:

bash
npm install sharp@0.29.0  # Try older versions

Check the package's release notes for glibc requirements.

4Force build from source

Some packages can rebuild from source with your system's glibc:

bash
npm install --build-from-source

This requires build tools:

bash
# Ubuntu/Debian
sudo apt-get install build-essential python3

# CentOS/RHEL
sudo yum groupinstall "Development Tools"
5Use a container with newer glibc

If you can't upgrade the host OS, run your app in a container:

bash
docker run -it --rm node:20 npm install your-package

For 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