Gatsby React App deploy failed from git

8:53:50 PM: Build ready to start
8:53:53 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
8:53:53 PM: build-image tag: v3.7.1
8:53:53 PM: buildbot version: 7bdd3b07036ec50a4d44b86fbdc90f52d3e07727
8:53:53 PM: Fetching cached dependencies
8:53:53 PM: Starting to download cache of 224.6MB
8:53:55 PM: Finished downloading cache in 2.083721901s
8:53:55 PM: Starting to extract cache
8:54:05 PM: Finished extracting cache in 9.415634724s
8:54:05 PM: Finished fetching cache in 11.577857493s
8:54:05 PM: Starting to prepare the repo for build
8:54:05 PM: Preparing Git Reference refs/heads/main
8:54:09 PM: Starting build script
8:54:09 PM: Installing dependencies
8:54:09 PM: Python version set to 2.7
8:54:10 PM: Started restoring cached node version
8:54:13 PM: Finished restoring cached node version
8:54:13 PM: v12.18.0 is already installed.
8:54:14 PM: Now using node v12.18.0 (npm v6.14.4)
8:54:14 PM: Started restoring cached build plugins
8:54:14 PM: Finished restoring cached build plugins
8:54:14 PM: Attempting ruby version 2.7.1, read from environment
8:54:16 PM: Using ruby version 2.7.1
8:54:16 PM: Using PHP version 5.6
8:54:16 PM: Started restoring cached node modules
8:54:16 PM: Finished restoring cached node modules
8:54:17 PM: Started restoring cached go cache
8:54:17 PM: Finished restoring cached go cache
8:54:17 PM: go version go1.14.4 linux/amd64
8:54:17 PM: go version go1.14.4 linux/amd64
8:54:17 PM: Installing missing commands
8:54:17 PM: Verify run directory
8:54:18 PM: ​
8:54:18 PM: ────────────────────────────────────────────────────────────────
8:54:18 PM: Netlify Build
8:54:18 PM: ────────────────────────────────────────────────────────────────
8:54:18 PM: ​
8:54:18 PM: ❯ Version
8:54:18 PM: @netlify/build 10.2.2
8:54:18 PM: ​
8:54:18 PM: ❯ Flags
8:54:18 PM: deployId: 6067683e7cce29dd2fab9556
8:54:19 PM: ​
8:54:19 PM: ❯ Current directory
8:54:19 PM: /opt/build/repo
8:54:19 PM: ​
8:54:19 PM: ❯ Config file
8:54:19 PM: No config file was defined: using default values.
8:54:19 PM: ​
8:54:19 PM: ❯ Context
8:54:19 PM: production
8:54:19 PM: ​
8:54:19 PM: ────────────────────────────────────────────────────────────────
8:54:19 PM: 1. Build command from Netlify app
8:54:19 PM: ────────────────────────────────────────────────────────────────
8:54:19 PM: ​
8:54:19 PM: $ gatsby build
8:54:23 PM: success open and validate gatsby-configs - 0.048s
8:54:24 PM: success load plugins - 1.381s
8:54:24 PM: success onPreInit - 0.122s
8:54:24 PM: success initialize cache - 0.024s
8:54:24 PM: success copy gatsby files - 0.079s
8:54:24 PM: success onPreBootstrap - 0.019s
8:54:25 PM: success loading DatoCMS schema - 1.111s
8:54:25 PM: success createSchemaCustomization - 1.132s
8:54:29 PM: success loading DatoCMS content - 3.434s
8:54:29 PM: success Checking for changed pages - 0.000s
8:54:29 PM: success source and transform nodes - 3.600s
8:54:30 PM: success building schema - 0.728s
8:54:30 PM: info Total nodes: 107, SitePage nodes: 1 (use --verbose for breakdown)
8:54:30 PM: success createPages - 0.056s
8:54:30 PM: success Checking for changed pages - 0.000s
8:54:30 PM: success createPagesStatefully - 0.115s
8:54:30 PM: success update schema - 0.078s
8:54:30 PM: success onPreExtractQueries - 0.000s
8:55:46 PM: ​
8:55:46 PM: ────────────────────────────────────────────────────────────────
8:55:46 PM: β€œbuild.command” failed
8:55:46 PM: ────────────────────────────────────────────────────────────────
8:55:46 PM: ​
8:55:46 PM: Error message
8:55:46 PM: Command was killed with SIGKILL (Forced termination): gatsby build
8:55:46 PM: ​
8:55:46 PM: Error location
8:55:46 PM: In Build command from Netlify app:
8:55:46 PM: gatsby build
8:55:46 PM: ​
8:55:46 PM: Resolved config
8:55:46 PM: build:
8:55:46 PM: command: gatsby build
8:55:46 PM: commandOrigin: ui
8:55:46 PM: environment:
8:55:46 PM: - DATO_API_TOKEN
8:55:46 PM: publish: /opt/build/repo/public
8:55:46 PM: Caching artifacts
8:55:46 PM: Started saving node modules
8:55:46 PM: Finished saving node modules
8:55:46 PM: Started saving build plugins
8:55:46 PM: Finished saving build plugins
8:55:46 PM: Started saving pip cache
8:55:46 PM: Finished saving pip cache
8:55:46 PM: Started saving emacs cask dependencies
8:55:46 PM: Finished saving emacs cask dependencies
8:55:46 PM: Started saving maven dependencies
8:55:47 PM: Finished saving maven dependencies
8:55:47 PM: Started saving boot dependencies
8:55:47 PM: Finished saving boot dependencies
8:55:47 PM: Started saving rust rustup cache
8:55:47 PM: Finished saving rust rustup cache
8:55:47 PM: Started saving go dependencies
8:55:47 PM: Finished saving go dependencies
8:55:47 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:55:47 PM: Failing build: Failed to build site
8:55:47 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
8:55:47 PM: Finished processing build request in 1m53.760901319s

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!

Does this topic help perhaps?

Unfortunately it didn’t help. Everything works fine with netlify cli using netlify deploy. However, when I use git, I have these errors. This is my package.json :

β€œscripts”: {
β€œdevelop”: β€œgatsby develop”,
β€œstart”: β€œgatsby develop”,
β€œbuild”: β€œgatsby build”,
β€œserve”: β€œgatsby serve”,
β€œclean”: β€œgatsby clean”
},
β€œdependencies”: {
β€œ@leanup/cli”: β€œ^1.1.10”,
β€œ@leanup/cli-preact”: β€œ^1.1.10”,
β€œ@material-ui/core”: β€œ^4.11.3”,
β€œ@raygesualdo/gatsby-plugin-babel-styled-components”: β€œ^1.0.1”,
β€œ@reach/router”: β€œ^1.3.4”,
β€œbabel-plugin-styled-components”: β€œ^1.12.0”,
β€œframer-motion”: β€œ^4.1.2”,
β€œgatsby”: β€œ^3.2.1”,
β€œgatsby-background-image”: β€œ^1.5.0”,
β€œgatsby-plugin-image”: β€œ^1.2.0”,
β€œgatsby-plugin-netlify”: β€œ^3.2.0”,
β€œgatsby-plugin-react-helmet”: β€œ^4.2.0”,
β€œgatsby-plugin-sass”: β€œ^4.2.0”,
β€œgatsby-plugin-sharp”: β€œ^3.2.0”,
β€œgatsby-plugin-styled-components”: β€œ^4.2.0”,
β€œgatsby-source-datocms”: β€œ^2.6.10”,
β€œgatsby-source-filesystem”: β€œ^3.2.0”,
β€œgatsby-transformer-sharp”: β€œ^3.2.0”,
β€œgbimage-bridge”: β€œ^0.1.2”,
β€œreact”: β€œ^17.0.2”,
β€œreact-cookie”: β€œ^4.0.3”,
β€œreact-cookie-banner”: β€œ^4.1.0”,
β€œreact-cookie-consent”: β€œ^6.2.3”,
β€œreact-dom”: β€œ^17.0.2”,
β€œreact-helmet”: β€œ^6.1.0”,
β€œreact-intersection-observer”: β€œ^8.31.0”,
β€œreact-router-dom”: β€œ^5.2.0”,
β€œsass”: β€œ^1.32.8”,
β€œstyled-components”: β€œ^5.2.3”,
β€œswiper”: β€œ^6.5.3”,
}

Hey there, @Rafael :wave:

This thread has been pretty quiet the past week. Are you still encountering issues with this deploy? Have you tried any additional debugging steps since you last posted? Let us know!

Like Perry said above, If you are still having issues please include what you have tried and what your build settings are. Additionally, if you could link your repo and your netlify site name that would be helpful!

The problem has been resolved. I reduced the size of the photos and used the Gatsby Cache Netlify Build Plugin as in this article: 5 Optimizations to Get Faster Gatsby Builds Today

Great to hear you got this working :netliconfetti: Thank you so much for sharing your solution. This will help future Forums members who encounter something similar, so we definitely appreciate it!