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)
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.
Go to AWS Amplify
- From the side menu, under
App settings, select
- On the page, scroll down to
Build image settings
Edit build image settingsmodal will show up.
Build imagesection, click on dropdown and select
public.ecr.aws/docker/library/node:18.17.0in 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?
- GLIBC: The GNU C Library, an implementation of the C standard library that most Linux uses.
- Follow the Github Issue, which is reported in Nov 2022