Friday, January 06, 2023

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

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, click on dropdown and select Build image
  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

Frontend Club

Subscribe to get our latest content by email.

    We won't send you spam. Unsubscribe at any time.

    © 2023 Frontend Club