node: version `GLIBC_2.28` not found (required by node)

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
3 min

banner

# node: version GLIBC_2.28 not found (required by node)

The error "node: version GLIBC_2.28 not found (required by node)" occurs when the node binary you're trying to install was built on a GLIBC-2.27 or more recent system.

To solve the error, install a Node.js version that is compatible with your operating system.

shell
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) node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28` not found (required by node) nvm is not compatible with the npm config "prefix" option: currently set Run `nvm use --delete-prefix v18.0.0` to unset it.

You can run the ldd --version command to check your GLIBC version.

shell
ldd --version

check glibc version

There are 2 common ways to solve the error:

  1. Install an older, more widely supported version of Node.js (16.X).
  2. Upgrade your Linux operating system to a newer version.

# Installing an older version of Node that is supported by your OS

If you use nvm, try to issue the following command to install an older Node.js version that is supported by your operating system.

shell
nvm install 16 nvm use 16

nvm install 16 13 0

Want to learn more about installing and using NVM? Check out these resources: Install NVM on macOS and Linux,Install NVM on Windows.

You can use the nvm ls command to check which nvm versions you have installed and which is the currently active version.

shell
nvm ls node --version

nvm list versions

If you want to uninstall a specific version, use the nvm uninstall command.

shell
# 👇️ Uninstall Node.js version 13.X.X nvm uninstall 13
The command will install and switch to version 16, which should resolve the issue.

# Installing nvm on your machine

If you don't have nvm installed, you can install it with the following command.

shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash chmod +x ~/.nvm/nvm.sh source ~/.bashrc

install-nvm

You might have to close and reopen your terminal to be able to use nvm after running the commands.

Try issuing the nvm -v command to verify nvm is installed.

shell
nvm -v

Install a version that is supported by your operating system, e.g. Node.js v16.

shell
nvm install 16 nvm use 16 nvm ls node --version

You can verify that Node.js is installed correctly by running the following command.

shell
node -e "console.log('Running Node.js ' + process.version)"

check if node 16 is installed

If you see a message that contains a version number, then Node.js is installed.

# Installing a newer Node.js version on Amazon Linux AMI causes the error

The error commonly occurs when you try to install a newer Node.js version (e.g. 18 or 19) on Amazon Linux AMI because the underlying operating system might not support the version of Node.js you're trying to install.

To get around this, you have to install an older, more widely supported Node.js version.

As noted in the docs, Amazon Linux 2 doesn't currently support the current LTS release (version 18.x) of Node.js.

They recommend using Node.js version 16.x by running the following nvm command.

shell
nvm install 16

You can verify that Node.js is installed correctly by running the following command.

shell
node -e "console.log('Running Node.js ' + process.version)"

check if node 16 is installed

If you see a message that contains a version number, then Node.js is installed.

# Using the n package to manage your Node.js version

You can also use the n package to manage your Node.js version.

shell
npm cache clean -f npm install -g n n 16.13.0

If you get a permissions error when issuing the commands, open CMD as an administrator (Windows) or prefix the commands with sudo (macOS and Linux).

shell
sudo npm cache clean -f sudo npm install -g n n 16.13.0

Alternatively, you can use the Previous Releases page of the official nodejs.org website to download a specific version of Node.js that is supported by your operating system.

# Updating your operating system

If the error persists, you can try updating your operating system, e.g. from Ubuntu version 18.04 to Ubuntu version 20.04.

Using the long-term supported version is recommended as the long-term supported version of your OS supports more recent versions of Node.js.

# Conclusion

The error "node: version GLIBC_2.28 not found (required by node)" occurs when the node binary you're trying to install was built on a GLIBC-2.28 or more recent system.

You can solve the error by:

  1. Installing a Node.js version that is compatible with your operating system.
  2. Upgrading your operating system to a newer version that supports more modern Node.js versions.

# Additional Resources

You can learn more about using NVM to manage your Node.js version by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.