Gatsby Adapter Issues

My build succeeds when gatsby-adapter-netlify is installed manually, but fails when it isn’t. Any ideas why?
Site: https://staging--tomtawadros.netlify.app
Build Log:

6:02:51 PM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
6:02:51 PM: buildbot version: 244d5322c7eb13029c1d65f78393f886c2e07fdb
6:02:51 PM: Fetching cached dependencies
6:02:51 PM: Starting to download cache of 479.6MB
6:02:53 PM: Finished downloading cache in 1.989s
6:02:53 PM: Starting to extract cache
6:02:58 PM: Finished extracting cache in 4.756s
6:02:58 PM: Finished fetching cache in 6.862s
6:02:58 PM: Starting to prepare the repo for build
6:02:58 PM: Preparing Git Reference refs/heads/staging
6:03:01 PM: Starting to install dependencies
6:03:01 PM: Python version set to 3.8
6:03:01 PM: Attempting Ruby version 2.7.2, read from environment
6:03:02 PM: Using Ruby version 2.7.2
6:03:03 PM: Started restoring cached go cache
6:03:03 PM: Finished restoring cached go cache
6:03:04 PM: go version go1.19.13 linux/amd64
6:03:05 PM: Using PHP version 8.0
6:03:07 PM: Started restoring cached Node.js version
6:03:08 PM: Finished restoring cached Node.js version
6:03:09 PM: v18.17.1 is already installed.
6:03:09 PM: Now using node v18.17.1 (npm v9.6.7)
6:03:09 PM: Enabling Node.js Corepack
6:03:09 PM: Started restoring cached build plugins
6:03:09 PM: Finished restoring cached build plugins
6:03:09 PM: Started restoring cached corepack dependencies
6:03:09 PM: Finished restoring cached corepack dependencies
6:03:09 PM: No npm workspaces detected
6:03:09 PM: Started restoring cached node modules
6:03:09 PM: Finished restoring cached node modules
6:03:10 PM: Installing npm packages using npm version 9.6.7
6:03:12 PM: npm WARN ERESOLVE overriding peer dependency
6:03:12 PM: npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
6:03:12 PM: npm WARN Found: react@18.3.1
6:03:12 PM: npm WARN node_modules/react
6:03:12 PM: npm WARN   react@"^18.2.0" from the root project
6:03:12 PM: npm WARN   12 more (@formspree/react, @gatsbyjs/reach-router, ...)
6:03:12 PM: npm WARN
6:03:12 PM: npm WARN Could not resolve dependency:
6:03:12 PM: npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
6:03:12 PM: npm WARN node_modules/react-server-dom-webpack
6:03:12 PM: npm WARN   react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.13.7
6:03:12 PM: npm WARN   node_modules/gatsby
6:03:12 PM: npm WARN
6:03:12 PM: npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
6:03:12 PM: npm WARN node_modules/react
6:03:12 PM: npm WARN   peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
6:03:12 PM: npm WARN   node_modules/react-server-dom-webpack
6:03:12 PM: npm WARN     react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.13.7
6:03:12 PM: npm WARN     node_modules/gatsby
6:03:19 PM: removed 44 packages, and audited 2171 packages in 9s
6:03:19 PM: 368 packages are looking for funding
6:03:19 PM:   run `npm fund` for details
6:03:19 PM: 73 vulnerabilities (1 low, 21 moderate, 34 high, 17 critical)
6:03:19 PM: To address issues that do not require attention, run:
6:03:19 PM:   npm audit fix
6:03:19 PM: To address all issues possible (including breaking changes), run:
6:03:19 PM:   npm audit fix --force
6:03:19 PM: Some issues need review, and may require choosing
6:03:19 PM: a different dependency.
6:03:19 PM: Run `npm audit` for details.
6:03:19 PM: npm packages installed
6:03:20 PM: Successfully installed dependencies
6:03:20 PM: Starting build script
6:03:22 PM: Detected 1 framework(s)
6:03:22 PM: "gatsby" at version "5.13.7"
6:03:22 PM: Section completed: initializing
6:03:24 PM: ​
6:03:24 PM: Netlify Build                                                 
6:03:24 PM: ────────────────────────────────────────────────────────────────
6:03:24 PM: ​
6:03:24 PM: ❯ Version
6:03:24 PM:   @netlify/build 29.54.3
6:03:24 PM: ​
6:03:24 PM: ❯ Flags
6:03:24 PM:   accountId: 6425de59d95c9f03682b0d66
6:03:24 PM:   baseRelDir: true
6:03:24 PM:   buildId: 66f48879c7aa290008b243dc
6:03:24 PM:   deployId: 66f48879c7aa290008b243de
6:03:24 PM: ​
6:03:24 PM: ❯ Current directory
6:03:24 PM:   /opt/build/repo
6:03:24 PM: ​
6:03:24 PM: ❯ Config file
6:03:24 PM:   No config file was defined: using default values.
6:03:24 PM: ​
6:03:24 PM: ❯ Context
6:03:24 PM:   branch-deploy
6:03:24 PM: ​
6:03:24 PM: ❯ Loading plugins
6:03:24 PM:    - @netlify/plugin-gatsby@3.8.1 from Netlify app
6:03:24 PM:    - @netlify/plugin-lighthouse@6.0.0 from Netlify app
6:03:26 PM: Skipping @netlify/plugin-gatsby work, because used Gatsby version supports adapters.
6:03:26 PM: ​
6:03:26 PM: Build command from Netlify app                                
6:03:26 PM: ────────────────────────────────────────────────────────────────
6:03:26 PM: ​
6:03:26 PM: $ npm run build
6:03:26 PM: > gatsby-starter-hello-world@0.1.0 build /opt/build/repo
6:03:26 PM: > gatsby build
6:03:30 PM: success compile gatsby files - 1.848s
6:03:30 PM: success load gatsby config - 0.068s
6:03:38 PM: (node:5508) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
6:03:38 PM: (Use `node --trace-deprecation ...` to show where the warning was created)
6:03:38 PM: gyp: binding.gyp not found (cwd: /opt/build/repo/.cache/adapters/node_modules/gatsby-adapter-netlify/node_modules/gatsby-core-utils/node_modules/lmdb/node_modules/node-addon-api) while trying to load binding.gyp
6:03:38 PM: gyp ERR! configure error
6:03:38 PM: gyp ERR! stack Error: `gyp` failed with exit code: 1
6:03:38 PM: gyp ERR! stack     at ChildProcess.onCpExit (/opt/build/repo/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
6:03:38 PM: gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
6:03:38 PM: gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
6:03:38 PM: gyp ERR! System Linux 5.10.223-212.873.amzn2.x86_64
6:03:38 PM: gyp ERR! command "/opt/buildhome/.nvm/versions/node/v18.17.1/bin/node" "/opt/build/repo/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
6:03:38 PM: gyp ERR! cwd /opt/build/repo/.cache/adapters/node_modules/gatsby-adapter-netlify/node_modules/gatsby-core-utils/node_modules/lmdb/node_modules/node-addon-api
6:03:38 PM: gyp ERR! node -v v18.17.1
6:03:38 PM: gyp ERR! node-gyp -v v3.6.0
6:03:38 PM: gyp ERR! not ok
6:03:38 PM: npm ERR! Linux 5.10.223-212.873.amzn2.x86_64
6:03:38 PM: npm ERR! argv "/opt/buildhome/.nvm/versions/node/v18.17.1/bin/node" "/opt/build/repo/node_modules/.bin/npm" "install" "--no-progress" "--no-audit" "--no-fund" "--loglevel" "error" "--color" "always" "--legacy-peer-deps" "--save-exact" "gatsby-adapter-netlify@^1.0.4"
6:03:38 PM: npm ERR! node v18.17.1
6:03:38 PM: npm ERR! npm  v2.15.12
6:03:38 PM: npm ERR! path /opt/build/repo/.cache/adapters/node_modules/gatsby-adapter-netlify/node_modules/gatsby-core-utils/node_modules/got/node_modules/@types/responselike/package.json
6:03:38 PM: npm ERR! code ENOTDIR
6:03:38 PM: npm ERR! errno -20
6:03:38 PM: npm ERR! syscall open
6:03:38 PM: 
6:03:38 PM: npm ERR! ENOTDIR: not a directory, open '/opt/build/repo/.cache/adapters/node_modules/gatsby-adapter-netlify/node_modules/gatsby-core-utils/node_modules/got/node_modules/@types/responselike/package.json'
6:03:38 PM: npm ERR!
6:03:38 PM: npm ERR! If you need help, you may report this error at:
6:03:38 PM: npm ERR!     <https://github.com/npm/npm/issues>
6:03:38 PM: 
6:03:38 PM: npm ERR! Please include the following file with any support request:
6:03:38 PM: npm ERR!     /opt/build/repo/.cache/adapters/npm-debug.log
6:03:38 PM: failed Installing Netlify adapter (gatsby-adapter-netlify@^1.0.4) - 8.227s
6:03:38 PM: error Could not install adapter "gatsby-adapter-netlify@^1.0.4". Please install it yourself by adding it to your package.json's dependencies and try building your project again.
6:03:38 PM: Zero-configuration deployment failed to avoid potentially broken deployment.
6:03:38 PM: If you want build to continue despite above problems:
6:03:38 PM:  - configure adapter manually in gatsby-config which will skip zero-configuration deployment attempt
6:03:38 PM:  - or set GATSBY_CONTINUE_BUILD_ON_MISSING_ADAPTER=true environment variable to continue build without an adapter.
6:03:39 PM: npm ERR! Linux 5.10.223-212.873.amzn2.x86_64
6:03:39 PM: npm ERR! argv "/opt/buildhome/.nvm/versions/node/v18.17.1/bin/node" "/opt/build/repo/node_modules/.bin/npm" "run" "build"
6:03:39 PM: npm ERR! node v18.17.1
6:03:39 PM: npm ERR! npm  v2.15.12
6:03:39 PM: npm ERR! code ELIFECYCLE
6:03:39 PM: npm ERR! gatsby-starter-hello-world@0.1.0 build: `gatsby build`
6:03:39 PM: npm ERR! Exit status 1
6:03:39 PM: npm ERR!
6:03:39 PM: npm ERR! Failed at the gatsby-starter-hello-world@0.1.0 build script 'gatsby build'.
6:03:39 PM: npm ERR! This is most likely a problem with the gatsby-starter-hello-world package,
6:03:39 PM: npm ERR! not with npm itself.
6:03:39 PM: npm ERR! Tell the author that this fails on your system:
6:03:39 PM: npm ERR!     gatsby build
6:03:39 PM: npm ERR! You can get information on how to open an issue for this project with:
6:03:39 PM: npm ERR!     npm bugs gatsby-starter-hello-world
6:03:39 PM: npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
6:03:39 PM: npm ERR!     npm owner ls gatsby-starter-hello-world
6:03:39 PM: npm ERR! There is likely additional logging output above.
6:03:39 PM: npm ERR! Please include the following file with any support request:
6:03:39 PM: npm ERR!     /opt/build/repo/npm-debug.log
6:03:39 PM: ​
6:03:39 PM: "build.command" failed                                        
6:03:39 PM: ────────────────────────────────────────────────────────────────
6:03:39 PM: ​
6:03:39 PM:   Error message
6:03:39 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
6:03:39 PM: ​
6:03:39 PM:   Error location
6:03:39 PM:   In Build command from Netlify app:
6:03:39 PM:   npm run build
6:03:39 PM: ​
6:03:39 PM:   Resolved config
6:03:39 PM:   build:
6:03:39 PM:     command: npm run build
6:03:39 PM:     commandOrigin: ui
6:03:39 PM:     environment:
6:03:39 PM:       - NODE_VERSION
6:03:39 PM:     publish: /opt/build/repo/public
6:03:39 PM:     publishOrigin: ui
6:03:39 PM:   plugins:
6:03:39 PM:     - inputs: {}
6:03:39 PM:       origin: ui
6:03:39 PM:       package: '@netlify/plugin-gatsby'
6:03:39 PM:     - inputs: {}
6:03:39 PM:       origin: ui
6:03:39 PM:       package: '@netlify/plugin-lighthouse'
6:03:40 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:03:40 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:03:40 PM: Failing build: Failed to build site
6:03:40 PM: Finished processing build request in 49.21s

Build Settings:
image