"build.command" failed Error message Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1) Error location In Build command from Netlify app: npm run build

I’ve tried changing npm run build to gatsby build under the build command. Tried deleting the package-lock.json and npm installing. I’m not sure what is wrong.

11:25:59 PM: Build ready to start
11:26:02 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
11:26:02 PM: build-image tag: v4.8.0
11:26:02 PM: buildbot version: 0475eccc4c4863180929fe6d58b546f8277ad384
11:26:02 PM: Fetching cached dependencies
11:26:02 PM: Failed to fetch cache, continuing with build
11:26:02 PM: Starting to prepare the repo for build
11:26:02 PM: No cached dependencies found. Cloning fresh repo
11:26:02 PM: git clone https://github.com/AdamJWatt88/Portfolio
11:26:09 PM: Preparing Git Reference refs/heads/main
11:26:11 PM: Parsing package.json dependencies
11:26:12 PM: Starting build script
11:26:12 PM: Installing dependencies
11:26:12 PM: Python version set to 2.7
11:26:13 PM: v16.14.2 is already installed.
11:26:13 PM: Now using node v16.14.2 (npm v8.5.0)
11:26:13 PM: Started restoring cached build plugins
11:26:13 PM: Finished restoring cached build plugins
11:26:13 PM: Attempting ruby version 2.7.2, read from environment
11:26:14 PM: Using ruby version 2.7.2
11:26:15 PM: Using PHP version 8.0
11:26:15 PM: No npm workspaces detected
11:26:15 PM: Started restoring cached node modules
11:26:15 PM: Finished restoring cached node modules
11:26:15 PM: Installing NPM modules using NPM version 8.5.0
11:26:28 PM: npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
11:26:28 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
11:26:28 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
11:26:28 PM: npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
11:26:29 PM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
11:26:29 PM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
11:26:31 PM: npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
11:26:36 PM: npm WARN deprecated subscriptions-transport-ws@0.9.19: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
11:26:38 PM: npm WARN deprecated async-cache@1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
11:26:45 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:27:06 PM: added 1736 packages, and audited 1737 packages in 50s
11:27:06 PM: 300 packages are looking for funding
11:27:06 PM:   run `npm fund` for details
11:27:06 PM: 27 vulnerabilities (6 moderate, 21 high)
11:27:06 PM: To address issues that do not require attention, run:
11:27:06 PM:   npm audit fix
11:27:06 PM: To address all issues possible (including breaking changes), run:
11:27:06 PM:   npm audit fix --force
11:27:06 PM: Some issues need review, and may require choosing
11:27:06 PM: a different dependency.
11:27:06 PM: Run `npm audit` for details.
11:27:06 PM: NPM modules installed
11:27:07 PM: Started restoring cached go cache
11:27:07 PM: Finished restoring cached go cache
11:27:07 PM: go version go1.16.5 linux/amd64
11:27:07 PM: go version go1.16.5 linux/amd64
11:27:07 PM: Installing missing commands
11:27:07 PM: Verify run directory
11:27:08 PM: ​
11:27:08 PM: ────────────────────────────────────────────────────────────────
11:27:08 PM:   Netlify Build                                                 
11:27:08 PM: ────────────────────────────────────────────────────────────────
11:27:08 PM: ​
11:27:08 PM: ❯ Version
11:27:08 PM:   @netlify/build 26.5.1
11:27:08 PM: ​
11:27:08 PM: ❯ Flags
11:27:08 PM:   baseRelDir: true
11:27:08 PM:   buildId: 62493df71efb4d0009cc797b
11:27:08 PM:   deployId: 62493df71efb4d0009cc797d
11:27:08 PM: ​
11:27:08 PM: ❯ Current directory
11:27:08 PM:   /opt/build/repo
11:27:08 PM: ​
11:27:08 PM: ❯ Config file
11:27:08 PM:   No config file was defined: using default values.
11:27:08 PM: ​
11:27:08 PM: ❯ Context
11:27:08 PM:   production
11:27:08 PM: ​
11:27:08 PM: ❯ Installing plugins
11:27:08 PM:    - @netlify/plugin-gatsby@2.1.4
11:27:24 PM: ​
11:27:24 PM: ❯ Loading plugins
11:27:24 PM:    - @netlify/plugin-gatsby@2.1.4 from Netlify app
11:27:26 PM: ​
11:27:26 PM: ────────────────────────────────────────────────────────────────
11:27:26 PM:   1. @netlify/plugin-gatsby (onPreBuild event)                  
11:27:26 PM: ────────────────────────────────────────────────────────────────
11:27:26 PM: ​
11:27:26 PM: No Gatsby cache found. Building fresh.
11:27:26 PM: public [
11:27:26 PM:   '231-6c7686233521f2e51162.js',
11:27:26 PM:   '231-6c7686233521f2e51162.js.map',
11:27:26 PM:   '404',
11:27:26 PM:   '404.html',
11:27:26 PM:   '610-ca5a7ca4b5c96f2532cd.js',
11:27:26 PM:   '610-ca5a7ca4b5c96f2532cd.js.map',
11:27:26 PM:   '711-5066f7f08e8850abc870.js',
11:27:26 PM:   '711-5066f7f08e8850abc870.js.map',
11:27:26 PM:   '_headers',
11:27:26 PM:   'app-79bec0a09714eab1471b.js',
11:27:26 PM:   'app-79bec0a09714eab1471b.js.map',
11:27:26 PM:   'chunk-map.json',
11:27:26 PM:   'component---src-pages-404-js-b17238dc335abea93be9.js',
11:27:26 PM:   'component---src-pages-404-js-b17238dc335abea93be9.js.map',
11:27:26 PM:   'component---src-pages-index-js-4075ec8f0ac0e00c5ef9.js',
11:27:26 PM:   'component---src-pages-index-js-4075ec8f0ac0e00c5ef9.js.map',
11:27:26 PM:   'favicon.ico',
11:27:26 PM:   'framework-675a07cb9aff63570c38.js',
11:27:26 PM:   'framework-675a07cb9aff63570c38.js.LICENSE.txt',
11:27:26 PM:   'framework-675a07cb9aff63570c38.js.map',
11:27:26 PM:   'index.html',
11:27:26 PM:   'page-data',
11:27:26 PM:   'polyfill-82df740e7cad994d0af0.js',
11:27:26 PM:   'polyfill-82df740e7cad994d0af0.js.map',
11:27:26 PM:   'static',
11:27:26 PM:   'styles.c094860727bdfdf6beec.css',
11:27:26 PM:   'webpack-runtime-344d236a307f8752779c.js',
11:27:26 PM:   'webpack-runtime-344d236a307f8752779c.js.map',
11:27:26 PM:   'webpack.stats.json'
11:27:26 PM: ]
11:27:26 PM: /opt/build/repo/.cache [
11:27:26 PM:   '.eslintrc.json',
11:27:26 PM:   '.nf-skip-gatsby-functions',
11:27:26 PM:   '.parcel-cache',
11:27:26 PM:   '_this_is_virtual_fs_path_',
11:27:26 PM:   'api-runner-browser-plugins.js',
11:27:26 PM:   'api-runner-browser.js',
11:27:26 PM:   'api-runner-ssr.js',
11:27:26 PM:   'api-ssr-docs.js',
11:27:26 PM:   'app.js',
11:27:26 PM:   'async-requires.js',
11:27:26 PM:   'babelState.json',
11:27:26 PM:   'blank.css',
11:27:26 PM:   'caches',
11:27:26 PM:   'caches-lmdb',
11:27:26 PM:   'commonjs',
11:27:26 PM:   'css-to-object.js',
11:27:26 PM:   'data',
11:27:26 PM:   'debug-log.js',
11:27:26 PM:   'default-html.js',
11:27:26 PM:   'dev-404-page.js',
11:27:26 PM:   'dev-loader.js',
11:27:26 PM:   'develop-html',
11:27:26 PM:   'develop-static-entry.js',
11:27:26 PM:   'dummy.js',
11:27:26 PM:   'emitter.js',
11:27:26 PM:   'ensure-resources.js',
11:27:26 PM:   'error-overlay-handler.js',
11:27:26 PM:   'fast-refresh-overlay',
11:27:26 PM:   'find-path.js',
11:27:26 PM:   'functions',
11:27:26 PM:   'gatsby-browser-entry.js',
11:27:26 PM:   'loader.js',
11:27:26 PM:   'loading-indicator',
11:27:26 PM:   'match-paths.json',
11:27:26 PM:   'navigation.js',
11:27:26 PM:   'normalize-page-path.js',
11:27:26 PM:   'page-renderer.js',
11:27:26 PM:   'page-ssr',
11:27:26 PM:   'pages.json',
11:27:26 PM:   'polyfill-entry.js',
11:27:26 PM:   'prefetch.js',
11:27:26 PM:   'production-app.js',
11:27:26 PM:   'public-page-renderer-dev.js',
11:27:26 PM:   'public-page-renderer-prod.js',
11:27:26 PM:   'public-page-renderer.js',
11:27:26 PM:   'query-engine',
11:27:26 PM:   'query-result-store.js',
11:27:26 PM:   'react-lifecycles-compat.js',
11:27:26 PM:   'redirect-utils.js',
11:27:26 PM:   'redirects.json',
11:27:26 PM:   'redux',
11:27:26 PM:   'register-service-worker.js',
11:27:26 PM:   'root.js',
11:27:26 PM:   'route-announcer-props.js',
11:27:26 PM:   'schema.gql',
11:27:26 PM:   'server-utils',
11:27:26 PM:   'shadow-portal.js',
11:27:26 PM:   'socketIo.js',
11:27:26 PM:   'ssr-builtin-trackers',
11:27:26 PM:   'ssr-develop-static-entry.js',
11:27:26 PM:   'static-entry.js',
11:27:26 PM:   'strip-prefix.js',
11:27:26 PM:   'sync-requires.js',
11:27:26 PM:   'test-require-error.js',
11:27:26 PM:   'tmp-2441-IJvhQUECQPKQ',
11:27:26 PM:   'tmp-2441-QyuKApt1OcXY',
11:27:26 PM:   'webpack',
11:27:26 PM:   'worker'
11:27:26 PM: ]
11:27:26 PM: ​
11:27:26 PM: (@netlify/plugin-gatsby onPreBuild completed in 24ms)
11:27:26 PM: ​
11:27:26 PM: ────────────────────────────────────────────────────────────────
11:27:26 PM:   2. Build command from Netlify app                             
11:27:30 PM: Creating deploy upload records
11:27:26 PM: ────────────────────────────────────────────────────────────────
11:27:26 PM: ​
11:27:26 PM: $ npm run build
11:27:26 PM: > gatsby-starter-hello-world@0.1.0 build
11:27:26 PM: > gatsby build
11:27:29 PM: error There was an unhandled error during compilation for /opt/build/repo. Please run the command with the --verbose flag again.
11:27:31 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
11:27:29 PM: 
11:27:29 PM: 
11:27:29 PM:   Error: std::bad_alloc
11:27:29 PM: 
11:27:29 PM: not finished compile gatsby files - 0.120s
11:27:29 PM: ​
11:27:29 PM: ────────────────────────────────────────────────────────────────
11:27:29 PM:   "build.command" failed                                        
11:27:29 PM: ────────────────────────────────────────────────────────────────
11:27:29 PM: ​
11:27:29 PM:   Error message
11:27:29 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
11:27:29 PM: ​
11:27:29 PM:   Error location
11:27:29 PM:   In Build command from Netlify app:
11:27:29 PM:   npm run build
11:27:29 PM: ​
11:27:29 PM:   Resolved config
11:27:29 PM:   build:
11:27:29 PM:     command: npm run build
11:27:29 PM:     commandOrigin: ui
11:27:29 PM:     publish: /opt/build/repo/public
11:27:29 PM:     publishOrigin: ui
11:27:29 PM:   headers:
11:27:29 PM:     - for: /*
      values:
        Referrer-Policy: same-origin
        X-Content-Type-Options: nosniff
        X-Frame-Options: DENY
        X-XSS-Protection: 1; mode=block
    - for: /component---src-pages-404-js-b17238dc335abea93be9.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /styles.c094860727bdfdf6beec.css
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /component---src-pages-index-js-4075ec8f0ac0e00c5ef9.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /webpack-runtime-344d236a307f8752779c.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /framework-675a07cb9aff63570c38.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /app-79bec0a09714eab1471b.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /static/*
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /sw.js
      values:
        Cache-Control: no-cache
    - for: /404/
      values:
        Link: </webpack-runtime-344d236a307f8752779c.js>; rel=preload; as=script, </framework-675a07cb9aff63570c38.js>; rel=preload; as=script, </app-79bec0a09714eab1471b.js>; rel=preload; as=script, </component---src-pages-404-js-b17238dc335abea93be9.js>; rel=preload; as=script, </page-data/app-data.json>; rel=preload; as=fetch; crossorigin, </page-data/404/page-data.json>; rel=preload; as=fetch; crossorigin
    - for: /404.html
      values:
        Link: </webpack-runtime-344d236a307f8752779c.js>; rel=preload; as=script, </framework-675a07cb9aff63570c38.js>; rel=preload; as=script, </app-79bec0a09714eab1471b.js>; rel=preload; as=script, </component---src-pages-404-js-b17238dc335abea93be9.js>; rel=preload; as=script, </page-data/app-data.json>; rel=preload; as=fetch; crossorigin, </page-data/404.html/page-data.json>; rel=preload; as=fetch; crossorigin
    - for: /
      values:
        Link: </webpack-runtime-344d236a307f8752779c.js>; rel=preload; as=script, </framework-675a07cb9aff63570c38.js>; rel=preload; as=script, </app-79bec0a09714eab1471b.js>; rel=preload; as=script, </component---src-pages-index-js-4075ec8f0ac0e00c5ef9.js>; rel=preload; as=script, </page-data/app-data.json>; rel=preload; as=fetch; crossorigin, </page-data/index/page-data.json>; rel=preload; as=fetch; crossorigin
  plugins:
    - inputs: {}
      origin: ui
      package: '@netlify/plugin-gatsby'
Caching artifacts
11:27:29 PM: Started saving node modules
11:27:29 PM: Finished saving node modules
11:27:29 PM: Started saving build plugins
11:27:29 PM: Finished saving build plugins
11:27:29 PM: Started saving pip cache
11:27:29 PM: Finished saving pip cache
11:27:29 PM: Started saving emacs cask dependencies
11:27:29 PM: Finished saving emacs cask dependencies
11:27:29 PM: Started saving maven dependencies
11:27:29 PM: Finished saving maven dependencies
11:27:29 PM: Started saving boot dependencies
11:27:29 PM: Finished saving boot dependencies
11:27:29 PM: Started saving rust rustup cache
11:27:29 PM: Finished saving rust rustup cache
11:27:29 PM: Started saving go dependencies
11:27:29 PM: Finished saving go dependencies
11:27:30 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:27:31 PM: Failing build: Failed to build site
11:27:31 PM: Finished processing build request in 1m29.048285201s

Hey there, @mooseBurrito :wave:

Thanks for reaching out! Can you please share a link to your site as well as the project repo? This will let us look into your case further. Thanks so much!

Absolutely! Thank you!

Here’s the repo
https://github.com/AdamJWatt88/Portfolio

I’m unsure as to which site link you would like (as i cannot get it deployed) but I will guess this? Sorry I am just not sure.
https://app.netlify.com/sites/jazzy-puppy-a6c456/overview

Hey @mooseBurrito,

I tried your repo:

and I was able to get it to work (however, there’s a different problem which I believe it not so difficult).

I deleted your public and .cache folders, also deleted package-lock.json and .DS_Store files. Finally, I set NODE_VERSION to 14 and that got the site to build to some extent:

https://app.netlify.com/sites/effortless-nougat-b44b41/deploys/624d8b85c88c2420f7acd3f8#L165

The new error, I believe you can solve by running npm i saas and then pushing the latest package.json to your repo.

All the files and folders I mentioned above should also be added to your .gitignore as a recommendation.

I have followed your instructions and have now arrived at new error

3:56:49 PM: Build ready to start
3:56:52 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
3:56:52 PM: build-image tag: v4.8.0
3:56:52 PM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
3:56:52 PM: Fetching cached dependencies
3:56:52 PM: Failed to fetch cache, continuing with build
3:56:52 PM: Starting to prepare the repo for build
3:56:53 PM: No cached dependencies found. Cloning fresh repo
3:56:53 PM: git clone https://github.com/AdamJWatt88/Portfolio
3:56:58 PM: Preparing Git Reference refs/heads/main
3:56:59 PM: Parsing package.json dependencies
3:57:00 PM: Starting build script
3:57:00 PM: Installing dependencies
3:57:00 PM: Python version set to 2.7
3:57:01 PM: Downloading and installing node v14.19.1...
3:57:01 PM: Downloading https://nodejs.org/dist/v14.19.1/node-v14.19.1-linux-x64.tar.xz...
3:57:01 PM: Computing checksum with sha256sum
3:57:01 PM: Checksums matched!
3:57:04 PM: Now using node v14.19.1 (npm v6.14.16)
3:57:04 PM: Started restoring cached build plugins
3:57:04 PM: Finished restoring cached build plugins
3:57:04 PM: Attempting ruby version 2.7.2, read from environment
3:57:05 PM: Using ruby version 2.7.2
3:57:05 PM: Using PHP version 8.0
3:57:05 PM: No npm workspaces detected
3:57:05 PM: Started restoring cached node modules
3:57:05 PM: Finished restoring cached node modules
3:57:06 PM: Installing NPM modules using NPM version 6.14.16
3:57:49 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
3:57:49 PM: > @parcel/watcher@2.0.5 install /opt/build/repo/node_modules/@parcel/watcher
3:57:49 PM: > node-gyp-build
3:57:49 PM: > msgpackr-extract@1.1.4 install /opt/build/repo/node_modules/msgpackr-extract
3:57:49 PM: > node-gyp-build-optional-packages
3:57:50 PM: > lmdb@2.2.4 install /opt/build/repo/node_modules/@parcel/cache/node_modules/lmdb
3:57:50 PM: > node-gyp-build
3:57:50 PM: > lmdb@2.2.6 install /opt/build/repo/node_modules/lmdb
3:57:50 PM: > node-gyp-build
3:57:50 PM: > sharp@0.30.3 install /opt/build/repo/node_modules/sharp
3:57:50 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
3:57:51 PM: sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.12.2/libvips-8.12.2-linux-x64.tar.br
3:57:51 PM: sharp: Integrity check passed for linux-x64
3:57:52 PM: > core-js@3.21.1 postinstall /opt/build/repo/node_modules/core-js
3:57:52 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:57:52 PM: > core-js-pure@3.21.1 postinstall /opt/build/repo/node_modules/core-js-pure
3:57:52 PM: > node -e "try{require('./postinstall')}catch(e){}"
3:57:53 PM: > es5-ext@0.10.60 postinstall /opt/build/repo/node_modules/es5-ext
3:57:53 PM: >  node -e "try{require('./_postinstall')}catch(e){}"
3:57:53 PM: > gatsby-telemetry@3.11.1 postinstall /opt/build/repo/node_modules/gatsby-telemetry
3:57:53 PM: > node src/postinstall.js || true
3:57:53 PM: > gatsby-cli@4.11.2 postinstall /opt/build/repo/node_modules/gatsby-cli
3:57:53 PM: > node scripts/postinstall.js
3:57:53 PM: > gatsby@4.11.2 postinstall /opt/build/repo/node_modules/gatsby
3:57:53 PM: > node scripts/postinstall.js
3:57:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: msgpackr-extract-win32-x64@1.1.0 (node_modules/msgpackr-extract-win32-x64):
3:57:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for msgpackr-extract-win32-x64@1.1.0: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
3:57:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: msgpackr-extract-linux-arm64@1.1.0 (node_modules/msgpackr-extract-linux-arm64):
3:57:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for msgpackr-extract-linux-arm64@1.1.0: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
3:57:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: msgpackr-extract-linux-arm@1.1.0 (node_modules/msgpackr-extract-linux-arm):
3:57:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for msgpackr-extract-linux-arm@1.1.0: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
3:57:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: msgpackr-extract-darwin-x64@1.1.0 (node_modules/msgpackr-extract-darwin-x64):
3:57:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for msgpackr-extract-darwin-x64@1.1.0: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
3:57:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: msgpackr-extract-darwin-arm64@1.1.0 (node_modules/msgpackr-extract-darwin-arm64):
3:57:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for msgpackr-extract-darwin-arm64@1.1.0: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
3:57:54 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
3:57:54 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:57:54 PM: added 1849 packages from 1034 contributors and audited 1855 packages in 48.052s
3:57:55 PM: 301 packages are looking for funding
3:57:55 PM:   run `npm fund` for details
3:57:55 PM: found 11 vulnerabilities (7 moderate, 3 high, 1 critical)
3:57:55 PM:   run `npm audit fix` to fix them, or `npm audit` for details
3:57:55 PM: NPM modules installed
3:57:56 PM: Started restoring cached go cache
3:57:56 PM: Finished restoring cached go cache
3:57:56 PM: go version go1.16.5 linux/amd64
3:57:56 PM: go version go1.16.5 linux/amd64
3:57:56 PM: Installing missing commands
3:57:56 PM: Verify run directory
3:57:57 PM: ​
3:57:57 PM: ────────────────────────────────────────────────────────────────
3:57:57 PM:   Netlify Build                                                 
3:57:57 PM: ────────────────────────────────────────────────────────────────
3:57:57 PM: ​
3:57:57 PM: ❯ Version
3:57:57 PM:   @netlify/build 26.5.2
3:57:57 PM: ​
3:57:57 PM: ❯ Flags
3:57:57 PM:   baseRelDir: true
3:57:57 PM:   buildId: 62520f3155c76400087d2a57
3:57:57 PM:   deployId: 62520f3155c76400087d2a59
3:57:57 PM: ​
3:57:57 PM: ❯ Current directory
3:57:57 PM:   /opt/build/repo
3:57:57 PM: ​
3:57:57 PM: ❯ Config file
3:57:57 PM:   No config file was defined: using default values.
3:57:57 PM: ​
3:57:57 PM: ❯ Context
3:57:57 PM:   production
3:57:57 PM: ​
3:57:57 PM: ❯ Installing plugins
3:57:57 PM:    - @netlify/plugin-gatsby@3.0.0
3:58:18 PM: ​
3:58:18 PM: ❯ Loading plugins
3:58:18 PM:    - @netlify/plugin-gatsby@3.0.0 from Netlify app
3:58:19 PM: ​
3:58:19 PM: ────────────────────────────────────────────────────────────────
3:58:19 PM:   1. @netlify/plugin-gatsby (onPreBuild event)                  
3:58:19 PM: ────────────────────────────────────────────────────────────────
3:58:19 PM: ​
3:58:19 PM: No Gatsby cache found. Building fresh.
3:58:19 PM: public [
3:58:19 PM:   '231-6c7686233521f2e51162.js',
3:58:19 PM:   '231-6c7686233521f2e51162.js.map',
3:58:19 PM:   '404',
3:58:19 PM:   '404.html',
3:58:19 PM:   '610-ca5a7ca4b5c96f2532cd.js',
3:58:19 PM:   '610-ca5a7ca4b5c96f2532cd.js.map',
3:58:19 PM:   '711-5066f7f08e8850abc870.js',
3:58:19 PM:   '711-5066f7f08e8850abc870.js.map',
3:58:19 PM:   '_headers',
3:58:19 PM:   'chunk-map.json',
3:58:19 PM:   'component---src-pages-404-js-b17238dc335abea93be9.js',
3:58:19 PM:   'component---src-pages-404-js-b17238dc335abea93be9.js.map',
3:58:19 PM:   'favicon.ico',
3:58:19 PM:   'framework-675a07cb9aff63570c38.js',
3:58:19 PM:   'framework-675a07cb9aff63570c38.js.LICENSE.txt',
3:58:19 PM:   'framework-675a07cb9aff63570c38.js.map',
3:58:19 PM:   'index.html',
3:58:19 PM:   'page-data',
3:58:19 PM:   'polyfill-82df740e7cad994d0af0.js',
3:58:19 PM:   'polyfill-82df740e7cad994d0af0.js.map',
3:58:19 PM:   'static',
3:58:19 PM:   'styles.c094860727bdfdf6beec.css',
3:58:19 PM:   'webpack.stats.json'
3:58:19 PM: ]
3:58:19 PM: /opt/build/repo/.cache [
3:58:19 PM:   '.eslintrc.json',
3:58:19 PM:   '.nf-skip-gatsby-functions',
3:58:19 PM:   '.parcel-cache',
3:58:19 PM:   '_this_is_virtual_fs_path_',
3:58:19 PM:   'api-runner-browser-plugins.js',
3:58:19 PM:   'api-runner-browser.js',
3:58:19 PM:   'api-runner-ssr.js',
3:58:19 PM:   'api-ssr-docs.js',
3:58:19 PM:   'app.js',
3:58:19 PM:   'async-requires.js',
3:58:19 PM:   'babelState.json',
3:58:19 PM:   'blank.css',
3:58:19 PM:   'caches',
3:58:19 PM:   'caches-lmdb',
3:58:19 PM:   'commonjs',
3:58:19 PM:   'css-to-object.js',
3:58:19 PM:   'data',
3:58:19 PM:   'debug-log.js',
3:58:19 PM:   'default-html.js',
3:58:19 PM:   'dev-loader.js',
3:58:19 PM:   'develop-static-entry.js',
3:58:19 PM:   'dummy.js',
3:58:19 PM:   'emitter.js',
3:58:19 PM:   'ensure-resources.js',
3:58:19 PM:   'error-overlay-handler.js',
3:58:19 PM:   'fast-refresh-overlay',
3:58:19 PM:   'find-path.js',
3:58:19 PM:   'functions',
3:58:19 PM:   'gatsby-browser-entry.js',
3:58:19 PM:   'loader.js',
3:58:19 PM:   'loading-indicator',
3:58:19 PM:   'match-paths.json',
3:58:19 PM:   'navigation.js',
3:58:19 PM:   'normalize-page-path.js',
3:58:19 PM:   'page-renderer.js',
3:58:19 PM:   'page-ssr',
3:58:19 PM:   'pages.json',
3:58:19 PM:   'polyfill-entry.js',
3:58:19 PM:   'prefetch.js',
3:58:19 PM:   'production-app.js',
3:58:19 PM:   'public-page-renderer-dev.js',
3:58:19 PM:   'public-page-renderer-prod.js',
3:58:19 PM:   'public-page-renderer.js',
3:58:19 PM:   'query-engine',
3:58:19 PM:   'query-result-store.js',
3:58:19 PM:   'react-lifecycles-compat.js',
3:58:19 PM:   'redirect-utils.js',
3:58:19 PM:   'redirects.json',
3:58:19 PM:   'redux',
3:58:19 PM:   'register-service-worker.js',
3:58:19 PM:   'root.js',
3:58:19 PM:   'route-announcer-props.js',
3:58:19 PM:   'server-utils',
3:58:19 PM:   'shadow-portal.js',
3:58:19 PM:   'socketIo.js',
3:58:19 PM:   'ssr-builtin-trackers',
3:58:19 PM:   'ssr-develop-static-entry.js',
3:58:19 PM:   'static-entry.js',
3:58:19 PM:   'strip-prefix.js',
3:58:19 PM:   'sync-requires.js',
3:58:19 PM:   'test-require-error.js',
3:58:19 PM:   'webpack'
3:58:19 PM: ]
3:58:19 PM: ​
3:58:19 PM: (@netlify/plugin-gatsby onPreBuild completed in 16ms)
3:58:19 PM: ​
3:58:19 PM: ────────────────────────────────────────────────────────────────
3:58:19 PM:   2. Build command from Netlify app                             
3:58:19 PM: ────────────────────────────────────────────────────────────────
3:58:19 PM: ​
3:58:19 PM: $ npm run build
3:58:19 PM: > gatsby-starter-hello-world@0.1.0 build /opt/build/repo
3:58:19 PM: > gatsby build
3:58:22 PM: success compile gatsby files - 0.614s
3:58:22 PM: success load gatsby config - 0.034s
3:58:22 PM: warning Plugin gatsby-plugin-portal is not compatible with your gatsby version 4.11.2 - It requires gatsby@^2.0.0
3:58:22 PM: warning Plugin gatsby-plugin-portal is not compatible with your gatsby version 4.11.2 - It requires gatsby@^2.0.0
3:58:23 PM: success load plugins - 0.714s
3:58:23 PM: success onPreInit - 0.007s
3:58:23 PM: success initialize cache - 0.028s
3:58:23 PM: success copy gatsby files - 0.102s
3:58:23 PM: success Compiling Gatsby Functions - 0.195s
3:58:23 PM: success onPreBootstrap - 0.203s
3:58:23 PM: success createSchemaCustomization - 0.011s
3:58:24 PM: success Checking for changed pages - 0.000s
3:58:24 PM: success source and transform nodes - 0.580s
3:58:24 PM: info Writing GraphQL type definitions to /opt/build/repo/.cache/schema.gql
3:58:25 PM: success building schema - 0.990s
3:58:25 PM: success createPages - 0.000s
3:58:25 PM: success createPagesStatefully - 0.287s
3:58:25 PM: info Total nodes: 87, SitePage nodes: 3 (use --verbose for breakdown)
3:58:25 PM: success Checking for changed pages - 0.000s
3:58:25 PM: success Cleaning up stale page-data - 0.002s
3:58:25 PM: success onPreExtractQueries - 0.000s
3:58:32 PM: success extract queries from components - 6.917s
3:58:32 PM: success write out redirect data - 0.062s
3:58:32 PM: success onPostBootstrap - 0.003s
3:58:32 PM: info bootstrap finished - 12.486s
3:58:32 PM: success write out requires - 0.011s
3:58:45 PM: success Building production JavaScript and CSS bundles - 12.656s
3:58:59 PM: success Building HTML renderer - 14.350s
3:58:59 PM: success Execute page configs - 0.015s
3:58:59 PM: success Caching Webpack compilations - 0.000s
3:58:59 PM: success run queries in workers - 0.002s - 0/0 0.00/s
3:58:59 PM: success Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 29.108s - 12/12 0.41/s
3:58:59 PM: success Merge worker state - 0.001s
3:58:59 PM: success Rewriting compilation hashes - 0.001s
3:58:59 PM: success Writing page-data.json files to public directory - 0.006s - 3/3 543.60/s
3:59:03 PM: error Page data from page-data.json for the failed page "/": {
3:59:03 PM:   "componentChunkName": "component---src-pages-index-js",
3:59:03 PM:   "path": "/",
3:59:03 PM:   "result": {
3:59:03 PM:     "pageContext": {}
3:59:03 PM:   },
3:59:03 PM:   "staticQueryHashes": []
3:59:03 PM: }
3:59:03 PM: failed Building static HTML for pages - 4.195s
3:59:03 PM: error Building static HTML failed for path "/"
3:59:03 PM: 
3:59:03 PM:   75 |     return context[query].data
3:59:03 PM:   76 |   } else {
3:59:03 PM: > 77 |     throw new Error(
3:59:03 PM:      |           ^
3:59:03 PM:   78 |       `The result of this StaticQuery could not be fetched.\n\n` +
3:59:03 PM:   79 |         `This is likely a bug in Gatsby and if refreshing the page does not fix it, ` +
3:59:03 PM:   80 |         `please open an issue in https://github.com/gatsbyjs/gatsby/issues`
3:59:03 PM: 
3:59:03 PM:   WebpackError: The result of this StaticQuery could not be fetched.
3:59:03 PM:   
3:59:03 PM:   - gatsby-browser-entry.js:77 
3:59:03 PM:     gatsby-starter-hello-world/.cache/gatsby-browser-entry.js:77:11
3:59:03 PM:   
3:59:03 PM:   - Hero.js:28 
3:59:03 PM:     gatsby-starter-hello-world/src/components/sections/Hero.js:28:30
3:59:03 PM:   
3:59:03 PM:   - extends.js:15 
3:59:03 PM:     [gatsby-starter-hello-world]/[@babel]/runtime/helpers/extends.js:15:1
3:59:03 PM:   
3:59:03 PM:   - AboutMe.js:5 
3:59:03 PM:     gatsby-starter-hello-world/src/components/sections/AboutMe.js:5:31
3:59:03 PM:   
3:59:03 PM:   - Footer.js:24 
3:59:03 PM:     gatsby-starter-hello-world/src/components/sections/Footer.js:24:38
3:59:03 PM:   
3:59:03 PM:   - static-entry.js:295 
3:59:03 PM:     gatsby-starter-hello-world/.cache/static-entry.js:295:22
3:59:03 PM:   
3:59:03 PM:   - react-dom.production.min.js:84 
3:59:03 PM:     [gatsby-starter-hello-world]/[react-dom]/cjs/react-dom.production.min.js:84:    1
3:59:03 PM:   
3:59:03 PM: 
3:59:03 PM: npm ERR! code ELIFECYCLE
3:59:03 PM: npm ERR! errno 1
3:59:03 PM: npm ERR! gatsby-starter-hello-world@0.1.0 build: `gatsby build`
3:59:03 PM: npm ERR! Exit status 1
3:59:03 PM: npm ERR!
3:59:03 PM: npm ERR! Failed at the gatsby-starter-hello-world@0.1.0 build script.
3:59:03 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
3:59:03 PM: npm ERR! A complete log of this run can be found in:
3:59:03 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-04-09T22_59_03_915Z-debug.log
3:59:04 PM: ​
3:59:04 PM: ────────────────────────────────────────────────────────────────
3:59:04 PM:   "build.command" failed                                        
3:59:04 PM: ────────────────────────────────────────────────────────────────
3:59:04 PM: ​
3:59:04 PM:   Error message
3:59:04 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
3:59:04 PM: ​
3:59:04 PM:   Error location
3:59:04 PM:   In Build command from Netlify app:
3:59:04 PM:   npm run build
3:59:04 PM: ​
3:59:04 PM:   Resolved config
3:59:06 PM: Creating deploy upload records
3:59:04 PM:   build:
3:59:04 PM:     command: npm run build
3:59:04 PM:     commandOrigin: ui
3:59:04 PM:     environment:
3:59:04 PM:       - NODE_VERSION
3:59:04 PM:     publish: /opt/build/repo/public
3:59:06 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:59:04 PM:     publishOrigin: ui
3:59:04 PM:   headers:
3:59:04 PM:     - for: /*
      values:
        Referrer-Policy: same-origin
        X-Content-Type-Options: nosniff
        X-Frame-Options: DENY
        X-XSS-Protection: 1; mode=block
    - for: /component---src-pages-404-js-b17238dc335abea93be9.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /styles.c094860727bdfdf6beec.css
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /component---src-pages-index-js-8702635dc89df4c086fb.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /webpack-runtime-d3e35aebbb0b5e384d66.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /framework-675a07cb9aff63570c38.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /app-90c5e94170bdd27fc96a.js
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /static/*
      values:
        Cache-Control: public, max-age=31536000, immutable
    - for: /sw.js
      values:
        Cache-Control: no-cache
    - for: /404/
      values:
        Link: </webpack-runtime-d3e35aebbb0b5e384d66.js>; rel=preload; as=script, </framework-675a07cb9aff63570c38.js>; rel=preload; as=script, </app-90c5e94170bdd27fc96a.js>; rel=preload; as=script, </component---src-pages-404-js-b17238dc335abea93be9.js>; rel=preload; as=script, </page-data/app-data.json>; rel=preload; as=fetch; crossorigin, </page-data/404/page-data.json>; rel=preload; as=fetch; crossorigin
    - for: /404.html
      values:
        Link: </webpack-runtime-d3e35aebbb0b5e384d66.js>; rel=preload; as=script, </framework-675a07cb9aff63570c38.js>; rel=preload; as=script, </app-90c5e94170bdd27fc96a.js>; rel=preload; as=script, </component---src-pages-404-js-b17238dc335abea93be9.js>; rel=preload; as=script, </page-data/app-data.json>; rel=preload; as=fetch; crossorigin, </page-data/404.html/page-data.json>; rel=preload; as=fetch; crossorigin
    - for: /
      values:
        Link: </webpack-runtime-d3e35aebbb0b5e384d66.js>; rel=preload; as=script, </framework-675a07cb9aff63570c38.js>; rel=preload; as=script, </app-90c5e94170bdd27fc96a.js>; rel=preload; as=script, </component---src-pages-index-js-8702635dc89df4c086fb.js>; rel=preload; as=script, </page-data/app-data.json>; rel=preload; as=fetch; crossorigin, </page-data/index/page-data.json>; rel=preload; as=fetch; crossorigin
  plugins:
    - inputs: {}
      origin: ui
      package: '@netlify/plugin-gatsby'
Caching artifacts
3:59:04 PM: Started saving node modules
3:59:04 PM: Finished saving node modules
3:59:04 PM: Started saving build plugins
3:59:04 PM: Finished saving build plugins
3:59:04 PM: Started saving pip cache
3:59:04 PM: Finished saving pip cache
3:59:04 PM: Started saving emacs cask dependencies
3:59:04 PM: Finished saving emacs cask dependencies
3:59:04 PM: Started saving maven dependencies
3:59:04 PM: Finished saving maven dependencies
3:59:04 PM: Started saving boot dependencies
3:59:04 PM: Finished saving boot dependencies
3:59:04 PM: Started saving rust rustup cache
3:59:04 PM: Finished saving rust rustup cache
3:59:04 PM: Started saving go dependencies
3:59:04 PM: Finished saving go dependencies
3:59:06 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:59:06 PM: Failing build: Failed to build site
3:59:06 PM: Finished processing build request in 2m14.067430654s

EDIT: Changing all of my useStaticQuery uses to StaticQuery makes this error go away and the site successfully deploys. Unfortunately the live page is this
Screen Shot 2022-04-09 at 6.37.37 PM

Hey @mooseBurrito,

Does this work locally?

It does work locally

I deployed your repo and it seems to work: https://regal-piroshki-c2af12.netlify.app/

Here’s my copy:

Oh strange, yeah it is working now. Thank you very much for your assistance! :grinning: