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.
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.
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 [email protected] # 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.
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.
npm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
npm ERR! code EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code EMPTYPACKAGE npm ERR! Package contains no files
How to fix 'npm ERR! code EMPTYPACKAGE' - Package contains no files
npm ERR! code EWORKSPACEMISSING npm ERR! Workspace does not exist: packages/missing
How to fix "npm ERR! code EWORKSPACEMISSING - Workspace does not exist" error
npm ERR! code EADDRNOTAVAIL npm ERR! errno EADDRNOTAVAIL npm ERR! Address not available
How to fix "npm ERR! code EADDRNOTAVAIL - Address not available" error