Try installing the active LTS version instead of latest with nvm install 16 (instead of nvm install node) as per the examples.
This was tested on the docker image amazonlinux:2 and correlates to what AWS CDK supports (ref)
Update
LTS has moved on for node, however, as per @djvg's comment, note there is a limitation with amazon linux 2 on glibc, so if requiring node > 16 will need to move to newer amazon linux version, eg: https://github.com/amazonlinux/amazon-linux-2023/blob/main/Release-Notes-Amazon-Linux-2022.0.20220728.0.md
Answer from Efren on Stack OverflowTry installing the active LTS version instead of latest with nvm install 16 (instead of nvm install node) as per the examples.
This was tested on the docker image amazonlinux:2 and correlates to what AWS CDK supports (ref)
Update
LTS has moved on for node, however, as per @djvg's comment, note there is a limitation with amazon linux 2 on glibc, so if requiring node > 16 will need to move to newer amazon linux version, eg: https://github.com/amazonlinux/amazon-linux-2023/blob/main/Release-Notes-Amazon-Linux-2022.0.20220728.0.md
It seems like you are using v.18.0.0 which was the latest but not well-supported.
Try uninstalling that.
Copynvm uninstall 18.0.0
Install a version that is active.
Copynvm install 16.0.0
You should now be using v16 which should be well-supported.
astrojs - Astro v 3 require Node js 18 and AWS amplify fail to build due to version `GLIBC_2.27' not found (required by node) - Stack Overflow
node.js - Installing node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node) error on linux - Stack Overflow
Node.js is showing error "node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)"
Astro build failing due to mismatched node version.
I had this issue - a solution was to use a custom build image like public.ecr.aws/docker/library/node:18.14.1 (18.14.1 being the minimum supported version by Astro) in your build image settings.
Some other solutions like nvm install <version> didn't change anything.
I used Amazon Linux:2023 Image and for my live package updates I added a Node.js one and set it to 18.14.1.
This worked and has been my first time successfully hosting an astro site with this recent issue.
This error happens when you install Node on an operating system that has a version of GLIBC that is lower than Node can support. For example, Node v18 supports GLIBC v2.7 or later. When you attempt to install Node v18.x on any Linux OS that has GLIBC v2.6 or lower, you will get such errors.
To see the version of GLIBC that your operating system has, execute the ldd command on the terminal:
Copy$ ldd --version
I can suggest three options to resolve this issue:
- Either install Node from source code. This will allow you to recompile
- Or install an older version of Node that your OS can support
- Or upgrade your Linux OS to a newer version.
Reference: Install Node from source code
Observed the same error on the Linux machine of AWS.
This error will also be observed when we have installed Node JS and when we check the version. To resolve the issue we need to have greater than GLIBCv2.6. Amazon provides Linux boxes with GLIBC v2.6 and greater version than this as well. Before starting dev work use the below command to select a suitable machine
command used : ldd --version (on Amazon Linux machine) :

As of April 2023, per this comment:
Node 18 available in the default Docker image for all builds! The version is pinned to 18.13.0, which you can leverage by simply adding the
nvm use 18command to your build spec.
version: 1
backend:
phases:
build:
commands:
- nvm use 18
- amplifyPush --simple
The same problem happened to me, I fixed it by adding a custom image in the build config.
You can see the steps to add a custom image in the following link
The image that worked for me was the following:
public.ecr.aws/t7o4u3y2/node-18.2.0:latest
UPDATE
Now is available support Node 18.x
Please see the update here
