🏠 Home

AWS Amplify - Specified Node 18 but GLIBC_2.27 or GLIBC_2.28 not found on build

If you have to use Node.js 18 for your build (ie. Gatsby 5) on AWS Amplify, you may have seen the error GLIBC_2.27 not found.

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)

Problem

By default AWS Amplify uses Amazon Linux:2 as its build image and it comes with GLIBC 2.26. However, building frontend apps that require Node.js 18 will require GLIBC 2.27 or 2.28.

Solution

Summary

You can either (1) set a node image for the specific version you plan to use or (2) select image Amazon Linux:2023. Amazon Linux:2023 should be more secure and will have active support.

How to fix it

Go to AWS Amplify

  1. From the side menu, under App settings, select Build settings
  2. On the page, scroll down to Build image settings
  3. Click Edit, an Edit build image settings modal will show up.
  4. Under Build image section, you can either pick a custom image or choose Amazon Linux:2023. If you decide to pick a custom image, click on dropdown and select Build image. Then go to step (5).
  5. Paste public.ecr.aws/docker/library/node:18.17.0 in Reference build image input (Note: Other than node version 18.17.0, you can also search for specific version of node on https://gallery.ecr.aws/docker/library/node)

Maybe, we can wait for Amazon Linux 2022 which uses GLIBC 2.34 to come to AWS Amplify?

Terminology

  • GLIBC: The GNU C Library, an implementation of the C standard library that most Linux uses.

Reference