Unknown Gatsby Build Error -- while trying to enable incremental builds

Hey Netlify,

While working on a client’s site I am getting this error

12:18:18 PM: npm ERR! code ELIFECYCLE
12:18:18 PM: npm ERR! errno 1
12:18:18 PM: npm ERR! @repo/web@1.0.1 build: `cross-env GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --verbose --log-pages`
12:18:18 PM: npm ERR! Exit status 1
12:18:18 PM: npm ERR!
12:18:18 PM: npm ERR! Failed at the @repo/web@1.0.1 build script.
12:18:18 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
12:18:18 PM: npm ERR! A complete log of this run can be found in:
12:18:18 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-11-22T09_18_18_371Z-debug.log
12:18:18 PM: ​
12:18:18 PM: ────────────────────────────────────────────────────────────────
12:18:18 PM:   "build.command" failed                                        
12:18:18 PM: ────────────────────────────────────────────────────────────────
12:18:18 PM: ​
12:18:18 PM:   Error message
12:18:18 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
12:18:18 PM: ​
12:18:18 PM:   Error location
12:18:18 PM:   In build.command from netlify.toml:
12:18:18 PM:   npm run build
12:18:18 PM: ​

As you can imagine I can’t make heads or tails of this. I have even tried to add a .npmrc file to no avail. I can confirm the build is working well locally, so I can’t make sense of what is really going on. I’m trying to add incremental builds that will reduce the amount of build time needed, so I am using cross-event as prescribed here. I am using gatsby v4.24, so I am not sure if the aforementioned solution is still relevant.

Link to build error here

Hey there @cmshaki :wave:

Thanks for your patience here. Looking closer at this, it appears as though you are having a memory issue.

Can you try using Docker image (here is a link explaining how to install it) to see how much memory your site uses? Our CI/CD build system uses this docker image to build, so we are suggesting you use the same conditions.

Once you understand how much memory is being used, you can work to optimize your memory usage.

Hey thank you Hillary, hopefully I can find out what could be causing the issue, will test out the container,