Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

node: /lib64/libc.so.6: version GLIBC not found after nvm install

Errornode: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by node)

Short answer

The Node.js binary was built against a newer glibc than the one on the server. Amazon Linux 2 ships glibc 2.26, and current official Node.js binaries need glibc 2.34 or newer. Move the instance to Amazon Linux 2023, which ships 2.34, or compile Node.js on the machine with nvm install -s.

  • Applies to Node.js 22, Node.js 24, nvm, Amazon Linux 2, Amazon Linux 2023
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the OS release and the glibc version on the server. Compare the glibc number with what the Node.js version you installed needs.

    cat /etc/os-release
    ldd --version | head -n 1
  2. 2Match what you see, then jump to its fix

    1. 1ldd shows glibc 2.26 on Amazon Linux 2, and the error asks for a higher GLIBC versionThe operating system is older than the Node.js binary supportsFix
    2. 2The instance must stay on Amazon Linux 2 for nowYou cannot change the OS yet, and the prebuilt binary does not fitFix

What does the error look like?

  • node: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by node)

Cause 1 of 2

The operating system is older than the Node.js binary supports

1Check

Amazon documents glibc 2.26 for Amazon Linux 2 and 2.34 for Amazon Linux 2023. The Node.js project lists glibc 2.34 or newer as the minimum for its official Linux x64 and arm64 builds.

ldd --version | head -n 1
node --version

2Fix

Launch a new instance from an Amazon Linux 2023 image, move the app there, and install Node.js again with nvm.

nvm install --lts

3Verify

Check that node starts and prints its version.

node --version
ldd --version | head -n 1

Confirmed by docs.aws.amazon.com

Did this fix it?

Cause 2 of 2

You cannot change the OS yet, and the prebuilt binary does not fit

1Check

nvm downloads prebuilt binaries by default. Its README says the -s flag makes nvm download the Node.js source and compile it locally, and recommends it when official binaries do not work because of shared library incompatibilities.

nvm --version

2Fix

Install a C++ toolchain, then compile on the server. It takes a long time, and AWS lists gcc 7.3 for Amazon Linux 2, so check the compiler a Node.js line needs in its BUILDING.md first. Treat this as a bridge until you can move to Amazon Linux 2023.

nvm install -s --lts

3Verify

Run node and check the version.

node --version

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • Check the glibc version of a base image before choosing a Node.js major version.
  • Pick Amazon Linux 2023 for new EC2 instances.
  • Set an nvm default alias so every new shell uses the version you tested.
  • Read the platform table in the Node.js build notes when you upgrade the Node.js major version.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Servers

nginx gives up waiting for the app and returns 504

upstream timed out (110: Connection timed out) while reading response header from upstream

nginx returns 504 when the app behind it takes the request but sends nothing back within proxy_read_timeout (60 seconds by default), or when the connection cannot be opened in time.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.