Gatsby build fails in Netlify after "run page queries", no errors shown

Hi all,

gatsby build runs perfectly fine on my local machine, but when I push to Netlify, there is an issue with the build even after clearing the cache (env vars are set to the same as my machine):

8:23:40 PM: $ gatsby build --verbose
8:23:42 PM: verbose 1.711379417 set gatsby_log_level: "verbose"
8:23:42 PM: verbose 1.713441479 set gatsby_executing_command: "build"
8:23:42 PM: verbose 1.714249905 loading local command from: /opt/build/repo/node_modules/gatsby/dist/commands/build.js
8:23:44 PM: verbose 3.691392851 running command: build
8:23:44 PM: success open and validate gatsby-configs - 0.116s
8:23:45 PM: warning Plugin gatsby-plugin-image is not compatible with your gatsby version 2.32.11 - It requires gatsby@^3.0.0-next.0
8:23:45 PM: warning Plugin gatsby-plugin-styled-components is not compatible with your gatsby version 2.32.11 - It requires gatsby@^3.0.0-next.0
8:23:45 PM: success load plugins - 1.485s
8:23:46 PM: success onPreInit - 0.148s
8:23:46 PM: success delete html and css files from previous builds - 0.003s
8:23:46 PM: success initialize cache - 0.008s
8:23:46 PM: success copy gatsby files - 0.062s
8:23:46 PM: success onPreBootstrap - 0.469s
8:23:46 PM: success createSchemaCustomization - 0.171s
8:23:47 PM: verbose 6.411874698 Checking for deleted pages
8:23:47 PM: verbose 6.412458529 Deleted 0 pages
8:23:47 PM: verbose 6.412630588 Found 0 changed pages
8:23:47 PM: success Checking for changed pages - 0.001s
8:23:47 PM: success source and transform nodes - 0.158s
8:23:47 PM: success building schema - 0.388s
8:23:47 PM: info Total nodes: 88, SitePage nodes: 1 (use --verbose for breakdown)
8:23:47 PM: verbose 6.824759306 Number of node types: 7. Nodes per type: SitePage: 1, SitePlugin: 55, Site: 1, SiteBuildMetadata: 1, Directory: 3, File: 17, ImageSharp: 10
8:23:47 PM: success createPages - 0.021s
8:23:47 PM: verbose 6.82536702 Checking for deleted pages
8:23:47 PM: verbose 6.825636063 Deleted 0 pages
8:23:47 PM: verbose 6.826109284 Found 0 changed pages
8:23:47 PM: success Checking for changed pages - 0.000s
8:23:47 PM: success createPagesStatefully - 0.166s
8:23:47 PM: success update schema - 0.024s
8:23:47 PM: success onPreExtractQueries - 0.001s
8:23:49 PM: success extract queries from components - 1.950s
8:23:49 PM: warning The GraphQL query in the non-page component "/opt/build/repo/src/templates/blog-post.js" will not be run.
8:23:49 PM: Exported queries are only executed for Page components. It's possible you're
8:23:49 PM: trying to create pages in your gatsby-node.js and that's failing for some
reason.
8:23:49 PM: If the failing component(s) is a regular component and not intended to be a page
8:23:49 PM: component, you generally want to use a <StaticQuery> (https://gatsbyjs.org/docs/static-query)
8:23:49 PM: instead of exporting a page query.
8:23:49 PM: If you're more experienced with GraphQL, you can also export GraphQL
fragments from components and compose the fragments in the Page component
8:23:49 PM: query and pass data down into the child component — https://graphql.org/learn/queries/#fragments
8:23:49 PM: success write out redirect data - 0.001s
8:23:49 PM: success Build manifest and related icons - 0.293s
8:23:49 PM: success onPostBootstrap - 0.296s
8:23:49 PM: info bootstrap finished - 9.270s
8:23:49 PM: warning Thank you for trying the beta version of the `gatsbyImageData` API. Please provide feedback and report any issues at: https://github.com/gatsbyjs/gatsby/discussions/27950
8:23:55 PM: success run static queries - 5.199s - 4/4 0.77/s
8:24:23 PM: success run page queries - 28.282s - 7/7 0.25/s
8:25:18 PM: ​
8:25:18 PM: ────────────────────────────────────────────────────────────────
8:25:18 PM:   "build.command" failed                                        
8:25:18 PM: ────────────────────────────────────────────────────────────────
8:25:18 PM: ​
8:25:18 PM:   Error message
8:25:18 PM:   Command was killed with SIGKILL (Forced termination): gatsby build --verbose
8:25:18 PM: ​
8:25:18 PM:   Error location
8:25:18 PM:   In Build command from Netlify app:
8:25:18 PM:   gatsby build --verbose
8:25:18 PM: ​
8:25:18 PM:   Resolved config
8:25:18 PM:   build:
8:25:18 PM:     command: gatsby build --verbose
8:25:18 PM:     commandOrigin: ui
8:25:18 PM:     publish: /opt/build/repo/public

Could you help identify what the issue is? I can’t replicate the issue locally so I believe it’s something happening in the build environment.

Thanks for the help!

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

That’s the error message right there. It means, your build ended up taking more than the allotted 3GB RAM and was thus force killed by the system. In most cases it’s due to the RAM issue, but it might be different in your case.

Thanks for the help Perry and hrishikesh! My reply got deleted so hopefully this one goes through.

I’ve tried:

  • Ensuring all the build settings are correct
  • Upgrading everything to Gatsby v3 (which removed mos the build warnings)
  • Even tried to revert to the previously working version, which now also has the same build error. I think this should’ve fixed it if it was a RAM issue but it didn’t

Going to share the logs:

Build error logs received when using old but previously working version (since the errors from the new version are the same as above):

12:39:30 PM: > gatsby build
12:39:34 PM: success open and validate gatsby-configs - 0.143s
12:39:36 PM: warning Plugin gatsby-plugin-styled-components is not compatible with your gatsby version 2.32.11 - It requires gatsby@^3.0.0-next.0
12:39:36 PM: success load plugins - 1.649s
12:39:36 PM: success onPreInit - 0.161s
12:39:36 PM: success delete html and css files from previous builds - 0.003s
12:39:36 PM: success initialize cache - 0.034s
12:39:36 PM: success copy gatsby files - 0.065s
12:39:37 PM: success onPreBootstrap - 0.538s
12:39:37 PM: success createSchemaCustomization - 0.220s
12:39:37 PM: success Checking for changed pages - 0.000s
12:39:37 PM: success source and transform nodes - 0.146s
12:39:38 PM: success building schema - 0.549s
12:39:38 PM: info Total nodes: 76, SitePage nodes: 4 (use --verbose for breakdown)
12:39:38 PM: success createPages - 0.043s
12:39:38 PM: success Checking for changed pages - 0.000s
12:39:38 PM: success createPagesStatefully - 0.134s
12:39:38 PM: success update schema - 0.042s
12:39:38 PM: success onPreExtractQueries - 0.001s
12:39:39 PM: success extract queries from components - 0.718s
12:39:39 PM: success write out redirect data - 0.001s
12:39:39 PM: success Build manifest and related icons - 0.298s
12:39:39 PM: success onPostBootstrap - 0.301s
12:39:39 PM: info bootstrap finished - 8.493s
12:39:39 PM: warning code block or inline code language not specified in markdown. applying generic code block
12:39:40 PM: success run static queries - 0.573s - 3/3 5.24/s
12:39:40 PM: success run page queries - 0.078s - 10/10 128.59/s
12:39:40 PM: success write out requires - 0.005s
12:40:19 PM: success Building production JavaScript and CSS bundles - 39.782s
12:40:20 PM: success Rewriting compilation hashes - 0.002s
12:40:39 PM: success Building HTML renderer - 18.901s
12:40:40 PM: success Building static HTML for pages - 1.816s - 10/10 5.51/s
12:40:40 PM: success Generating image thumbnails - 61.419s - 9/9 0.15/s
12:40:40 PM: success onPostBuild - 0.016s
12:40:40 PM: info Done building in 70.014496344 sec
12:40:41 PM: USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
12:40:41 PM: root           1  2.0  0.1 1539440 44060 ?       Ssl  11:38   0:02 /opt/build-bin/buildbot eyJzaXRlX2lkIjoiYTI3MDJkZWEtMmZlNi00OTUxLWIyOTMtODgzY2I5NmFjZTIyIiwiYnVpbGRfaWQiOiI2MDY4NTNjMGQ5ZmRkNDAwMDc3ZjFkZDAiLCJhY2NvdW50X2lkIjoiNWVmZTU3ZTdhZmUwNmUwMWMyODkzYWI2IiwiZGVwbG95X2lkIjoiNjA2ODUzYzBkOWZkZDQwMDA3N2YxZGQyIiwicmVwb191cmwiOiJodHRwczovL3gtYWNjZXNzLXRva2VuOmdoc19GSVE2VkNoSlZZWENpZWhHeEdwQ1VUQ3RteHMwdGE0QURZcXBAZ2l0aHViLmNvbS9lZG1vbmR0YW0xL3BlZ2d5LXdlYnNpdGUiLCJyZXBvX3VybF9hZnRlciI6bnVsbCwibmV0bGlmeV9hcGlfZW5kcG9pbnQiOm51bGwsImVucXVldWVkX2F0IjoiMjAyMS0wNC0wM1QxMTozODo0MFoiLCJlbnYiOnsiTk9ERV9WRVJTSU9OIjoiMTQuMTUuMSIsIk5QTV9WRVJTSU9OIjoiNi4xNC44IiwiVVJMIjoiaHR0cHM6Ly9qb2xseS1zaG9ja2xleS1lZjRiM2MubmV0bGlmeS5hcHAiLCJTSVRFX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WpvaU5qQTJPRFV6WXpCa09XWmtaRFF3TURBM04yWXhaR1F3SW4xOS5LbVFnQ0lzNjhjejR6U0hxOXk3VkZqYy1WbkwxdjRtcnJia0VkQ2VOWTlNIn19fQ==
12:40:41 PM: buildbot     101  0.3  0.0  52428 10896 ?        S    11:38   0:00 /bin/bash /opt/build-bin/build /opt/build/repo 12.18.0 2.7.1 1.22.4 npm run build && ps auxw; false /tmp/zisi-606853c0d9fdd400077f1dd2 /opt/build/cache api.netlify.com 1uzr80eSfuKi1S_uk_QbZzAu11-C6eKfvWP5s1fPijA true {   "siteInfo": {     "id": "a2702dea-2fe6-4951-b293-883cb96ace22"   },   "env": {},   "buildDir": "/opt/build/repo",   "config": {     "functions": {},     "plugins": [],     "build": {       "environment": {         "BRANCH": "main",         "CONTEXT": "production",         "DEPLOY_PRIME_URL": "https://main--jolly-shockley-ef4b3c.netlify.app",         "DEPLOY_URL": "https://606853c0d9fdd400077f1dd2--jolly-shockley-ef4b3c.netlify.app",         "GO_VERSION": "1.14.4",         "NETLIFY_IMAGES_CDN_DOMAIN": "d33wubrfki0l68.cloudfront.net",         "NODE_VERSION": "14.15.1",         "NPM_VERSION": "6.14.8",         "SITE_ID": "a2702dea-2fe6-4951-b293-883cb96ace22",         "SITE_NAME": "jolly-shockley-ef4b3c",         "URL": "https://jolly-shockley-ef4b3c.netlify.app"       },       "publish": "/opt/build/repo/public",       "command": "npm run build && ps auxw; false",       "commandOrigin": "ui"     }   },   "context": "production",   "branch": "main" }  /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/bin//netlify-build /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/bin//node /tmp/netlify-buildbot-socket bitballoon_always_drain_request_body,bitballoon_deploy_preview_subdomain_query,bitballoon_drain_request_body,bitballoon_file_manifest_dedup,bitballoon_include_dangling_builds,bitballoon_issue_ecdsa,bitballoon_site_chain_enabled,buildbot_build_telemetry,buildbot_disable_tracing,deploy_cache_key_without_reseller,deprecate_list_forms_endpoint,enable-function-log-scroll-lock,form_submission_emails_subaccount,netlify-server-account-redirect-lookup,netlify-server-backfill-blob-store-lookups,netlify-server-blob-finder-cache-byaccount,netlify-server-block-ip-requests,netlify-server-conditional-requests,netlify-server-header-rules-manifest,netlify-server-manifest-lookup-byaccount,netlify-server-post-processing,netlify-server-redirect-manifest-lookup,netlify-server-request-rate-limiting,netlify-server-request-rate-limiting-host,netlify-server-request-rate-limiting-ip,netlify-server-request-rate-limiting-prerender,netlify-server-site-finder-byhost,netlify-server-site-finder-withdeploy-byhost,netlify_labs,project_aerodactyl_ui,project_charizard_ui,project_krabby_ui,project_mission_control_ui,project_piplup_ui,project_rapidash_ui,proxy-block-ip-requests,proxy-composite-cache-key-enabled,read_loaded_deploy_from_secondaries,service_buildbot_cache_pip_subdirectory,service_buildbot_disable_autodetach,service_buildbot_disable_slow_firebase_push,service_buildbot_dont_hardcode_oneclick_branch,service_buildbot_set_ci_env,socketeer-structured-node-logging,test_one_for_demo
12:40:41 PM: buildbot    1465  3.7  0.4 23852372 132612 ?     Sl   11:39   0:02 /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/bin//node /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/bin//netlify-build --node-path=/opt/buildhome/.nvm/versions/node/v14.15.1/bin/node --cachedConfig={   "siteInfo": {     "id": "a2702dea-2fe6-4951-b293-883cb96ace22"   },   "env": {},   "buildDir": "/opt/build/repo",   "config": {     "functions": {},     "plugins": [],     "build": {       "environment": {         "BRANCH": "main",         "CONTEXT": "production",         "DEPLOY_PRIME_URL": "https://main--jolly-shockley-ef4b3c.netlify.app",         "DEPLOY_URL": "https://606853c0d9fdd400077f1dd2--jolly-shockley-ef4b3c.netlify.app",         "GO_VERSION": "1.14.4",         "NETLIFY_IMAGES_CDN_DOMAIN": "d33wubrfki0l68.cloudfront.net",         "NODE_VERSION": "14.15.1",         "NPM_VERSION": "6.14.8",         "SITE_ID": "a2702dea-2fe6-4951-b293-883cb96ace22",         "SITE_NAME": "jolly-shockley-ef4b3c",         "URL": "https://jolly-shockley-ef4b3c.netlify.app"       },       "publish": "/opt/build/repo/public",       "command": "npm run build && ps auxw; false",       "commandOrigin": "ui"     }   },   "context": "production",   "branch": "main" }  --api-host=api.netlify.com --token=1uzr80eSfuKi1S_uk_QbZzAu11-C6eKfvWP5s1fPijA --deploy-id=606853c0d9fdd400077f1dd2 --mode=buildbot --telemetry=true --send-status --statsd.host=datadog-agent --statsd.port=8125 --functions-dist-dir=/tmp/zisi-606853c0d9fdd400077f1dd2 --cache-dir=/opt/build/cache --buildbot-server-socket=/tmp/netlify-buildbot-socket --feature-flags=bitballoon_always_drain_request_body,bitballoon_deploy_preview_subdomain_query,bitballoon_drain_request_body,bitballoon_file_manifest_dedup,bitballoon_include_dangling_builds,bitballoon_issue_ecdsa,bitballoon_site_chain_enabled,buildbot_build_telemetry,buildbot_disable_tracing,deploy_cache_key_without_reseller,deprecate_list_forms_endpoint,enable-function-log-scroll-lock,form_submission_emails_subaccount,netlify-server-account-redirect-lookup,netlify-server-backfill-blob-store-lookups,netlify-server-blob-finder-cache-byaccount,netlify-server-block-ip-requests,netlify-server-conditional-requests,netlify-server-header-rules-manifest,netlify-server-manifest-lookup-byaccount,netlify-server-post-processing,netlify-server-redirect-manifest-lookup,netlify-server-request-rate-limiting,netlify-server-request-rate-limiting-host,netlify-server-request-rate-limiting-ip,netlify-server-request-rate-limiting-prerender,netlify-server-site-finder-byhost,netlify-server-site-finder-withdeploy-byhost,netlify_labs,project_aerodactyl_ui,project_charizard_ui,project_krabby_ui,project_mission_control_ui,project_piplup_ui,project_rapidash_ui,proxy-block-ip-requests,proxy-composite-cache-key-enabled,read_loaded_deploy_from_secondaries,service_buildbot_cache_pip_subdirectory,service_buildbot_disable_autodetach,service_buildbot_disable_slow_firebase_push,service_buildbot_dont_hardcode_oneclick_branch,service_buildbot_set_ci_env,socketeer-structured-node-logging,test_one_for_demo --testOpts.silentLingeringProcesses=
12:40:41 PM: buildbot    1476  0.0  0.0  45160  3264 ?        S    11:39   0:00 bash -c npm run build && ps auxw; false
12:40:41 PM: buildbot    1518  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1524  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1531  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1538  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1739 13.3  0.0      0     0 ?        Z    11:40   0:02 [node] <defunct>
12:40:41 PM: buildbot    1746  0.8  0.0      0     0 ?        Z    11:40   0:00 [node] <defunct>
12:40:41 PM: buildbot    1753  0.9  0.0      0     0 ?        Z    11:40   0:00 [node] <defunct>
12:40:41 PM: buildbot    1760  0.9  0.0      0     0 ?        Z    11:40   0:00 [node] <defunct>
12:40:41 PM: buildbot    1771  0.0  0.0  61528  3356 ?        R    11:40   0:00 ps auxw
12:40:41 PM: ​
12:40:41 PM: ────────────────────────────────────────────────────────────────
12:40:41 PM:   "build.command" failed                                        
12:40:41 PM: ────────────────────────────────────────────────────────────────
12:40:41 PM: ​
12:40:41 PM:   Error message
12:40:41 PM:   Command failed with exit code 1: npm run build && ps auxw; false
12:40:41 PM: ​
12:40:41 PM:   Error location
12:40:41 PM:   In Build command from Netlify app:
12:40:41 PM:   npm run build && ps auxw; false
12:40:41 PM: ​
12:40:41 PM:   Resolved config
12:40:41 PM:   build:
12:40:41 PM:     command: npm run build && ps auxw; false
12:40:41 PM:     commandOrigin: ui
12:40:41 PM:     environment:
12:40:41 PM:       - NODE_VERSION
12:40:41 PM:       - NPM_VERSION
12:40:41 PM:     publish: /opt/build/repo/public
12:40:41 PM: Caching artifacts
12:40:41 PM: Started saving node modules
12:40:41 PM: Finished saving node modules
12:40:41 PM: Started saving build plugins
12:40:41 PM: Finished saving build plugins
12:40:41 PM: Started saving pip cache
12:40:41 PM: Finished saving pip cache
12:40:41 PM: Started saving emacs cask dependencies
12:40:41 PM: Finished saving emacs cask dependencies
12:40:41 PM: Started saving maven dependencies
12:40:41 PM: Finished saving maven dependencies
12:40:41 PM: Started saving boot dependencies
12:40:42 PM: Finished saving boot dependencies
12:40:42 PM: Started saving rust rustup cache
12:40:42 PM: Finished saving rust rustup cache
12:40:42 PM: Started saving go dependencies
12:40:42 PM: Finished saving go dependencies
12:40:45 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:40:45 PM: Failing build: Failed to build site
12:40:45 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:40:45 PM: Finished processing build request in 2m3.788907823s

package.json of the new version:

{
  "name": "my-website",
  "private": true,
  "version": "0.1.0",
  "author": "edomondo",
  "bugs": {
    "url": "https://github.com/gatsbyjs/gatsby/issues"
  },
  "dependencies": {
    "@material-ui/core": "^4.11.3",
    "aos": "^2.3.4",
    "babel-plugin-styled-components": "^1.12.0",
    "gatsby": "^3.2.1",
    "gatsby-plugin-feed": "^3.2.0",
    "gatsby-plugin-google-analytics": "^3.2.0",
    "gatsby-plugin-image": "^1.2.0",
    "gatsby-plugin-manifest": "^3.2.0",
    "gatsby-plugin-material-ui": "^3.0.0",
    "gatsby-plugin-offline": "^4.2.0",
    "gatsby-plugin-postcss": "^4.2.0",
    "gatsby-plugin-react-helmet": "^4.2.0",
    "gatsby-plugin-react-svg": "^3.0.0",
    "gatsby-plugin-sharp": "^3.2.0",
    "gatsby-plugin-styled-components": "^4.2.0",
    "gatsby-plugin-web-font-loader": "^1.0.4",
    "gatsby-remark-copy-linked-files": "^3.2.0",
    "gatsby-remark-images": "^4.2.0",
    "gatsby-remark-prismjs": "^4.2.0",
    "gatsby-remark-responsive-iframe": "^3.2.0",
    "gatsby-remark-smartypants": "^3.2.0",
    "gatsby-source-filesystem": "^3.2.0",
    "gatsby-theme-material-ui": "^1.0.13",
    "gatsby-transformer-remark": "^3.2.0",
    "gatsby-transformer-sharp": "^3.2.0",
    "prismjs": "^1.23.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-helmet": "^6.1.0",
    "react-parallax": "^3.2.1",
    "styled-components": "^5.2.3",
    "typeface-merriweather": "^1.1.13",
    "typeface-montserrat": "^1.1.13"
  },
  "devDependencies": {
    "@tailwindcss/postcss7-compat": "^2.0.4",
    "autoprefixer": "^9.8.6",
    "eslint-config-react-app": "^6.0.0",
    "postcss": "^8.2.9",
    "prettier": "2.2.1",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.4"
  },
  "homepage": "",
  "keywords": [
    "gatsby"
  ],
  "license": "0BSD",
  "main": "n/a",
  "repository": {
    "type": "git",
    "url": ""
  },
  "resolutions": {
    "sharp": "0.27.0"
  },
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop",
    "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
    "start": "npm run develop",
    "serve": "gatsby serve",
    "clean": "gatsby clean",
    "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
  }
}

gatsby-config.js of the new version:

module.exports = {
  siteMetadata: {
    title: `My website`,
    author: {
      name: `edomondo`,
      summary: `Netlify enthusiast.`,
    },
    description: `A website.`,
    siteUrl: `https://gatsby-starter-blog-demo.netlify.app/`,
    social: {
      twitter: `edomondo`,
    },
  },
  plugins: [
    // {
    //   resolve: `gatsby-source-filesystem`,
    //   options: {
    //     path: `${__dirname}/content/blog`,
    //     name: `blog`,
    //   },
    // },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/assets`,
        name: `assets`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-images`,
            options: {
              maxWidth: 630,
            },
          },
          {
            resolve: `gatsby-remark-responsive-iframe`,
            options: {
              wrapperStyle: `margin-bottom: 1.0725rem`,
            },
          },
          `gatsby-remark-prismjs`,
          `gatsby-remark-copy-linked-files`,
          `gatsby-remark-smartypants`,
        ],
      },
    },
    `gatsby-plugin-image`,
    `gatsby-transformer-sharp`,
    `gatsby-plugin-sharp`,
    // {
    //   resolve: `gatsby-plugin-google-analytics`,
    //   options: {
    //     //trackingId: `ADD YOUR TRACKING ID HERE`,
    //   },
    // },
    `gatsby-plugin-feed`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `Gatsby Starter Blog`,
        short_name: `GatsbyJS`,
        start_url: `/`,
        background_color: `#ffffff`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `content/assets/gatsby-icon.png`,
      },
    },
    `gatsby-plugin-react-helmet`,
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
    {
      resolve: "gatsby-plugin-web-font-loader",
      options: {
        typekit: {
          id: process.env.TYPEKIT_ID,
        },
      },
    },
    {
      resolve: 'gatsby-plugin-react-svg',
      options: {
        rule: {
          include: /.svg$/
        }
      }
    },
    {
      resolve: `gatsby-plugin-material-ui`,
      options: {
        stylesProvider: {
          injectFirst: true,
        },
      },
    },
    {
      resolve: `gatsby-theme-material-ui`,
      options: {
        webFontsConfig: {
          fonts: {
            google: [
              {
                family: `Raleway`,
                variants: [`300`, `400`, `500`],
              },
            ],
          },
        },
      },
    },
    {
      resolve: `gatsby-plugin-styled-components`,
      options: {
        // Add any options here
      },
    },
    {
      resolve: `gatsby-plugin-postcss`,
      options: {
      },
    },
  ],
  flags: {
    FAST_DEV: true,
  },
}

Many thanks for the help!

Also, I’m getting the following error with the old build:

12:39:30 PM: > gatsby build
12:39:34 PM: success open and validate gatsby-configs - 0.143s
12:39:36 PM: warning Plugin gatsby-plugin-styled-components is not compatible with your gatsby version 2.32.11 - It requires gatsby@^3.0.0-next.0
12:39:36 PM: success load plugins - 1.649s
12:39:36 PM: success onPreInit - 0.161s
12:39:36 PM: success delete html and css files from previous builds - 0.003s
12:39:36 PM: success initialize cache - 0.034s
12:39:36 PM: success copy gatsby files - 0.065s
12:39:37 PM: success onPreBootstrap - 0.538s
12:39:37 PM: success createSchemaCustomization - 0.220s
12:39:37 PM: success Checking for changed pages - 0.000s
12:39:37 PM: success source and transform nodes - 0.146s
12:39:38 PM: success building schema - 0.549s
12:39:38 PM: info Total nodes: 76, SitePage nodes: 4 (use --verbose for breakdown)
12:39:38 PM: success createPages - 0.043s
12:39:38 PM: success Checking for changed pages - 0.000s
12:39:38 PM: success createPagesStatefully - 0.134s
12:39:38 PM: success update schema - 0.042s
12:39:38 PM: success onPreExtractQueries - 0.001s
12:39:39 PM: success extract queries from components - 0.718s
12:39:39 PM: success write out redirect data - 0.001s
12:39:39 PM: success Build manifest and related icons - 0.298s
12:39:39 PM: success onPostBootstrap - 0.301s
12:39:39 PM: info bootstrap finished - 8.493s
12:39:39 PM: warning code block or inline code language not specified in markdown. applying generic code block
12:39:40 PM: success run static queries - 0.573s - 3/3 5.24/s
12:39:40 PM: success run page queries - 0.078s - 10/10 128.59/s
12:39:40 PM: success write out requires - 0.005s
12:40:19 PM: success Building production JavaScript and CSS bundles - 39.782s
12:40:20 PM: success Rewriting compilation hashes - 0.002s
12:40:39 PM: success Building HTML renderer - 18.901s
12:40:40 PM: success Building static HTML for pages - 1.816s - 10/10 5.51/s
12:40:40 PM: success Generating image thumbnails - 61.419s - 9/9 0.15/s
12:40:40 PM: success onPostBuild - 0.016s
12:40:40 PM: info Done building in 70.014496344 sec
12:40:41 PM: USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
12:40:41 PM: root           1  2.0  0.1 1539440 44060 ?       Ssl  11:38   0:02 /opt/build-bin/buildbot ***
12:40:41 PM: buildbot     101  0.3  0.0  52428 10896 ?        S    11:38   0:00 /bin/bash /opt/build-bin/build /opt/build/repo 12.18.0 2.7.1 1.22.4 npm run build && ps auxw; ***
12:40:41 PM: buildbot    1465  3.7  0.4 23852372 132612 ?     Sl   11:39   0:02 /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/bin//node /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/bin//netlify-build ***
12:40:41 PM: buildbot    1476  0.0  0.0  45160  3264 ?        S    11:39   0:00 bash -c npm run build && ps auxw; false
12:40:41 PM: buildbot    1518  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1524  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1531  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1538  0.1  0.0      0     0 ?        Z    11:39   0:00 [node] <defunct>
12:40:41 PM: buildbot    1739 13.3  0.0      0     0 ?        Z    11:40   0:02 [node] <defunct>
12:40:41 PM: buildbot    1746  0.8  0.0      0     0 ?        Z    11:40   0:00 [node] <defunct>
12:40:41 PM: buildbot    1753  0.9  0.0      0     0 ?        Z    11:40   0:00 [node] <defunct>
12:40:41 PM: buildbot    1760  0.9  0.0      0     0 ?        Z    11:40   0:00 [node] <defunct>
12:40:41 PM: buildbot    1771  0.0  0.0  61528  3356 ?        R    11:40   0:00 ps auxw
12:40:41 PM: ​
12:40:41 PM: ────────────────────────────────────────────────────────────────
12:40:41 PM:   "build.command" failed                                        
12:40:41 PM: ────────────────────────────────────────────────────────────────
12:40:41 PM: ​
12:40:41 PM:   Error message
12:40:41 PM:   Command failed with exit code 1: npm run build && ps auxw; false
12:40:41 PM: ​
12:40:41 PM:   Error location
12:40:41 PM:   In Build command from Netlify app:
12:40:41 PM:   npm run build && ps auxw; false
12:40:41 PM: ​
12:40:41 PM:   Resolved config
12:40:41 PM:   build:
12:40:41 PM:     command: npm run build && ps auxw; false
12:40:41 PM:     commandOrigin: ui
12:40:41 PM:     environment:
12:40:41 PM:       - NODE_VERSION
12:40:41 PM:       - NPM_VERSION
12:40:41 PM:     publish: /opt/build/repo/public
12:40:41 PM: Caching artifacts
12:40:41 PM: Started saving node modules
12:40:41 PM: Finished saving node modules
12:40:41 PM: Started saving build plugins
12:40:41 PM: Finished saving build plugins
12:40:41 PM: Started saving pip cache
12:40:41 PM: Finished saving pip cache
12:40:41 PM: Started saving emacs cask dependencies
12:40:41 PM: Finished saving emacs cask dependencies
12:40:41 PM: Started saving maven dependencies
12:40:41 PM: Finished saving maven dependencies
12:40:41 PM: Started saving boot dependencies
12:40:42 PM: Finished saving boot dependencies
12:40:42 PM: Started saving rust rustup cache
12:40:42 PM: Finished saving rust rustup cache
12:40:42 PM: Started saving go dependencies
12:40:42 PM: Finished saving go dependencies
12:40:45 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:40:45 PM: Failing build: Failed to build site
12:40:45 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:40:45 PM: Finished processing build request in 2m3.788907823s

Hey there, @edomondo :wave:

Looks like this thread has been quiet for the past week or so. Are you still encountering issues with this? If so, have you taken any additional steps since you last posted?

Thanks!

Hi Hillary,

Nope it’s still failing entirely (both the old and new versions). I haven’t been able to figure it out but I was able to copy the built files into a new website and I guess that will do for now.

The last steps seemed like the most logical and at this stage I’m happy to just find another way to deploy my site, but will go there only if necessary.

Many thanks,
Edmond

Hi, @edomondo. There is no error in the build logs posted on Apr 5th.

The build exited successfully. If it had not, the ps command would never have run due to the logical AND between the build ands ps commands. This is the build command used:

npm run build && ps auxw; false

So, if npm run build had an error, then the ps auxw would never have run. However, we know the ps command ran because we can see its output in the logs.

It is the ; false which cause the build to fail. If false always returns a non-zero exit code (and all non-zero exit codes are considered errors in Linux/Unix systems - which the build image is):

$ false ; echo $?
1

The echo $? above shows the exit code of the previous command - which is 1. An exit code of 1 is an error so this will always fail the build.

Remove that and it should work.

If there are other questions or concerns, please let us know.

Edit: Here is the manual page for false:

NAME
       false - do nothing, unsuccessfully

SYNOPSIS
       false [ignored command line arguments]
       false OPTION

DESCRIPTION
       Exit with a status code indicating failure.