Report this

What is the reason for this report?

GatsbyJS build with Apps fails because of missing glibc

Posted on April 21, 2022

Hey,

I have a GatsbyJS instance running in App Platform, and the build started failing a few days ago:

[2022-04-21 07:54:55] Project contains yarn.lock, using yarn
[2022-04-21 07:54:55] Installing node_modules using yarn (from yarn.lock)
[2022-04-21 07:54:55] Running yarn install
[2022-04-21 07:54:55] 
[2022-04-21 07:54:55] node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
[2022-04-21 07:54:55] 
[2022-04-21 07:54:55] unable to invoke layer creator
[2022-04-21 07:54:55] installing node_modules: exit status 1
[2022-04-21 07:54:55] ERROR: failed to build: exit status 1
[2022-04-21 07:54:58] 
[2022-04-21 07:54:58] For documentation on the buildpacks used to build your app, please see:
[2022-04-21 07:54:58]    Node.js: https://do.co/apps-buildpack-node
[2022-04-21 07:54:58] 
[2022-04-21 07:54:58]  ! Build failed (145)

Code wise, nothing changed. The build, when run on local linux or macos, runs just fine. I also tried to use a docker image with App Platform, which runs but in the end fails with an out of memory error. I also tried to downgrade the required node engine in package.json from 17 to 16, still the same result.

Thanks

jan



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

This usually happens when the Node version your Gatsby app is asking for was built against a newer glibc than the App Platform build environment provides. Even if nothing changed in your code, the upstream Node build or your lockfile may have pulled in a binary that expects glibc 2.28, while the App Platform build image still ships an older glibc.

The quick workaround is to pin a Node version that App Platform’s buildpacks actually support. Node 14 or 16 typically works, but it has to match exactly what the buildpack provides, not just any variant of that major version. Adding an .nvmrc or setting "engines": { "node": "16.x" } and reinstalling dependencies usually forces the buildpack to use a compatible binary.

https://docs.digitalocean.com/products/app-platform/reference/buildpacks/nodejs/

Another option is to build with a custom Dockerfile so you control the glibc version yourself, but that’s heavier.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.