Intermittent build failure on upgrade to Gatsby 5: 'No native build...'

Hi, Iโ€™ve been having an intermittent build failure across branch deploys and deploy previews for a few days, ever since I upgraded packages - most notably, upgrading Gatsby to v5. The PR for that upgrade is galasa-dev/galasa.dev#557. The sites (galasa and galasa-local) get the following build failure on gatsby build --log-pages:

3:10:50 PM: error There was a problem loading the local build command. Gatsby may not be installed. Perhaps you need to run "npm install"? No native build was found for platform=linux arch=x64 runtime=node abi=108 uv=1 libc=glibc node=18.13.0
3:10:50 PM:     loaded from: /opt/build/repo/node_modules/lmdb and package: @lmdb/lmdb-linux-x64
3:10:50 PM: 
3:10:50 PM: 
3:10:50 PM:   Error: No native build was found for platform=linux arch=x64 runtime=node abi=  108 uv=1 libc=glibc node=18.13.0
3:10:50 PM:       loaded from: /opt/build/repo/node_modules/lmdb and package: @lmdb/lmdb-lin  ux-x64
3:10:50 PM:   
3:10:50 PM:   - index.js:64 Function.load.path
3:10:50 PM:     [repo]/[node-gyp-build-optional-packages]/index.js:64:9
3:10:50 PM:   
3:10:50 PM:   - index.js:20 Object.load [as default]
3:10:50 PM:     [repo]/[node-gyp-build-optional-packages]/index.js:20:30
3:10:50 PM:   
3:10:50 PM:   - native.js:9 Object.<anonymous>
3:10:50 PM:     [repo]/[lmdb]/native.js:9:34
3:10:50 PM:   
3:10:50 PM:   - loader:1218 Module._compile
3:10:50 PM:     node:internal/modules/cjs/loader:1218:14
3:10:50 PM:   
3:10:50 PM:   - loader:1272 Object.Module._extensions..js
3:10:50 PM:     node:internal/modules/cjs/loader:1272:10
3:10:50 PM:   
3:10:50 PM:   - loader:1081 Module.load
3:10:50 PM:     node:internal/modules/cjs/loader:1081:32
3:10:50 PM:   
3:10:50 PM:   - loader:922 Function.Module._load
3:10:50 PM:     node:internal/modules/cjs/loader:922:12
3:10:50 PM:   
3:10:50 PM:   - loader:1105 Module.require
3:10:50 PM:     node:internal/modules/cjs/loader:1105:19
3:10:50 PM:   
3:10:50 PM:   - helpers:103 require
3:10:50 PM:     node:internal/modules/cjs/helpers:103:18
3:10:50 PM:   
3:10:50 PM:   - cache-lmdb.ts:1 Object.<anonymous>
3:10:50 PM:     [repo]/[gatsby]/src/utils/cache-lmdb.ts:1:1
3:10:50 PM:   
3:10:50 PM:   - loader:1218 Module._compile
3:10:50 PM:     node:internal/modules/cjs/loader:1218:14
3:10:50 PM:   
3:10:50 PM:   - loader:1272 Object.Module._extensions..js
3:10:50 PM:     node:internal/modules/cjs/loader:1272:10
3:10:50 PM:   
3:10:50 PM:   - loader:1081 Module.load
3:10:50 PM:     node:internal/modules/cjs/loader:1081:32
3:10:50 PM:   
3:10:50 PM:   - loader:922 Function.Module._load
3:10:50 PM:     node:internal/modules/cjs/loader:922:12
3:10:50 PM:   
3:10:50 PM:   - loader:1105 Module.require
3:10:50 PM:     node:internal/modules/cjs/loader:1105:19
3:10:50 PM:   
3:10:50 PM:   - helpers:103 require
3:10:50 PM:     node:internal/modules/cjs/helpers:103:18
3:10:50 PM:   
3:10:50 PM: 
3:10:50 PM: โ€‹
3:10:50 PM:   "build.command" failed                                        
3:10:50 PM: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
3:10:50 PM: โ€‹
3:10:50 PM:   Error message
3:10:50 PM:   Command failed with exit code 1: gatsby build --log-pages (https://ntl.fyi/exit-code-1)
3:10:50 PM: โ€‹
3:10:50 PM:   Error location
3:10:50 PM:   In Build command from Netlify app:
3:10:50 PM:   gatsby build --log-pages
3:10:50 PM: โ€‹
3:10:50 PM:   Resolved config
3:10:50 PM:   build:
3:10:50 PM:     command: gatsby build --log-pages
3:10:50 PM:     commandOrigin: ui
3:10:50 PM:     environment:
3:10:50 PM:       - GATSBY_GALASA_ENV
3:10:50 PM:       - NPM_FLAGS
3:10:50 PM:       - REVIEW_ID
3:10:50 PM:     publish: /opt/build/repo/public
3:10:50 PM:     publishOrigin: ui

Iโ€™ve been using the latest Essential Gatsby plugin. Iโ€™ve now removed the plugin, to see if that helps things, but it still fails intermittently.

Any ideas? Thanks for your help!

I seem to have a workaround (hopefully, though the problem was intermittent) โ€“ to specifically override the version of lmdb in use.

The question is, why is this build working fine in GitHub Actions but problematic in Netlify? Does Netlify have a local npm cache that might perhaps be corrupting in some way?

1 Like

Hi @ind1go :wave:t6: ,

Welcome to the forums and thanks so much for reaching out! :netliconfetti: Iโ€™m glad to hear you found a workaround. Other users who have experienced this mentioned downgrading Gatsby.

Iโ€™m not sure this applied to your specific case but there was previous bug that was filed relating to intermittent build failure and Gatsby. Linked here: Intermittent Build Failures at Merge Worker State ยท Issue #259 ยท netlify/netlify-plugin-gatsby ยท GitHub