Build Error "build.command" failed exit code 127: gatsby build

Getting this error message only when I do a “Clean cache & deploy site” If I just update my site through a change in my Gitthub Repo it builds fine. The site also builds fine on my local box.

11:10:55 AM: Build ready to start
11:10:58 AM: build-image version: 3031d4c9e432fd7016f6279fc9ad706f9205d845
11:10:58 AM: build-image tag: v3.3.17
11:10:58 AM: buildbot version: 1f35b3abd6e2bf5230d8edf68072840fdec1513f
11:10:58 AM: Fetching cached dependencies
11:10:58 AM: Starting to download cache of 254.3KB
11:10:58 AM: Finished downloading cache in 65.084838ms
11:10:58 AM: Starting to extract cache
11:10:58 AM: Failed to fetch cache, continuing with build
11:10:58 AM: Starting to prepare the repo for build
11:10:59 AM: No cached dependencies found. Cloning fresh repo
11:10:59 AM: git clone
11:11:12 AM: Preparing Git Reference refs/heads/master
11:11:15 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘public’ versus ‘public/’ in the Netlify UI
11:11:15 AM: Starting build script
11:11:15 AM: Installing dependencies
11:11:15 AM: Python version set to 2.7
11:11:16 AM: Downloading and installing node v10.21.0…
11:11:16 AM: Downloading https://nodejs.org/dist/v10.21.0/node-v10.21.0-linux-x64.tar.xz
11:11:17 AM: Computing checksum with sha256sum
11:11:17 AM: Checksums matched!
11:11:19 AM: Now using node v10.21.0 (npm v6.14.4)
11:11:19 AM: Started restoring cached build plugins
11:11:19 AM: Finished restoring cached build plugins
11:11:19 AM: Attempting ruby version 2.6.2, read from environment
11:11:21 AM: Using ruby version 2.6.2
11:11:21 AM: Using PHP version 5.6
11:11:21 AM: 5.2 is already installed.
11:11:21 AM: Using Swift version 5.2
11:11:21 AM: Started restoring cached node modules
11:11:24 AM: Finished restoring cached node modules
11:11:24 AM: Installing NPM modules using NPM version 6.14.4
11:11:36 AM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js
11:11:36 AM: > node -e “try{require(’./postinstall’)}catch(e){}”
11:11:36 AM: npm WARN repo No description
11:11:36 AM: npm WARN repo No repository field.
11:11:36 AM: npm WARN repo No README data
11:11:36 AM: npm WARN repo No license field.
11:11:36 AM: added 92 packages from 81 contributors in 11.086s
11:11:36 AM: 13 packages are looking for funding
11:11:36 AM: run npm fund for details
11:11:36 AM: found 0 vulnerabilities
11:11:36 AM: NPM modules installed
11:11:36 AM: Started restoring cached go cache
11:11:36 AM: Finished restoring cached go cache
11:11:36 AM: Installing Go version 1.12
11:11:41 AM: unset GOOS;
11:11:41 AM: unset GOARCH;
11:11:41 AM: export GOROOT=’/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64’;
11:11:41 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:{PATH}"; 11:11:41 AM: go version >&2; 11:11:41 AM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env" 11:11:41 AM: go version go1.12 linux/amd64 11:11:41 AM: Installing missing commands 11:11:41 AM: Verify run directory 11:11:43 AM: ​ 11:11:43 AM: ┌─────────────────────────────┐ 11:11:43 AM: │ Netlify Build │ 11:11:43 AM: └─────────────────────────────┘ 11:11:43 AM: ​ 11:11:43 AM: ❯ Version 11:11:43 AM: @netlify/build 2.0.10 11:11:43 AM: ​ 11:11:43 AM: ❯ Flags 11:11:43 AM: deployId: 5ef8dd2f240cd513f9a474ac 11:11:43 AM: mode: buildbot 11:11:43 AM: ​ 11:11:43 AM: ❯ Current directory 11:11:43 AM: /opt/build/repo 11:11:43 AM: ​ 11:11:43 AM: ❯ Config file 11:11:43 AM: No config file was defined: using default values. 11:11:43 AM: ​ 11:11:43 AM: ❯ Context 11:11:43 AM: production 11:11:43 AM: ​ 11:11:43 AM: ┌────────────────────────────────┐ 11:11:43 AM: │ 1. Build command from settings │ 11:11:43 AM: └────────────────────────────────┘ 11:11:43 AM: ​ 11:11:43 AM: gatsby build
11:11:43 AM: bash: gatsby: command not found
11:11:43 AM: ​
11:11:43 AM: ┌─────────────────────────────┐
11:11:43 AM: │ “build.command” failed │
11:11:43 AM: └─────────────────────────────┘
11:11:43 AM: ​
11:11:43 AM: Error message
11:11:43 AM: Command failed with exit code 127: gatsby build
11:11:43 AM: ​
11:11:43 AM: Error location
11:11:43 AM: In Build command from settings:
11:11:43 AM: gatsby build
11:11:43 AM: ​
11:11:43 AM: Resolved config
11:11:43 AM: build:
11:11:43 AM: command: gatsby build
11:11:43 AM: publish: /opt/build/repo/public
11:11:43 AM: Caching artifacts
11:11:43 AM: Started saving node modules
11:11:43 AM: Finished saving node modules
11:11:43 AM: Started saving build plugins
11:11:43 AM: Finished saving build plugins
11:11:43 AM: Started saving pip cache
11:11:50 AM: Finished saving pip cache
11:11:50 AM: Started saving emacs cask dependencies
11:11:50 AM: Finished saving emacs cask dependencies
11:11:50 AM: Started saving maven dependencies
11:11:50 AM: Finished saving maven dependencies
11:11:50 AM: Started saving boot dependencies
11:11:50 AM: Finished saving boot dependencies
11:11:51 AM: Started saving go dependencies
11:11:52 AM: Finished saving go dependencies
11:11:55 AM: Error running command: Build script returned non-zero exit code: 1
11:11:55 AM: Failing build: Failed to build site
11:11:55 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
11:11:55 AM: Finished processing build request in 57.514287866s

can you post your package.json please?

{
“name”: “gatsby-starter-flex”,
“version”: “1.2.5”,
“private”: true,
“author”: “gatsby-starter-flex”,
“license”: “MIT”,
“starter-name”: “gatsby-starter-flex”,
“keywords”: [
“Fastpitch”,
“Softball”,
“Recruiting”,
“AZ Hotshots”
],
“bugs”: {
“url”: “https://github.com/arshad/gatsby-themes/issues
},
“homepage”: “https://github.com/arshad/gatsby-themes”,
“repository”: {
“type”: “git”,
“url”: “https://github.com/arshad/gatsby-starter-flex.git
},
“scripts”: {
“build”: “gatsby build”,
“start”: “gatsby develop”,
“serve”: “gatsby serve”,
“clean”: “gatsby clean”,
“dev”: “gatsby clean && gatsby develop”,
“preview”: “gatsby build && gatsby serve”
},
“devDependencies”: {
“gatsby”: “^2.21.11”,
“react”: “^16.13.1”,
“react-dom”: “^16.13.1”
},
“dependencies”: {
@mdx-js/mdx”: “^1.6.5”,
@mdx-js/react”: “^1.6.5”,
“gatsby”: “^2.21.11”,
“gatsby-plugin-google-adsense”: “^1.1.3”,
“gatsby-plugin-google-analytics”: “^2.3.2”,
“gatsby-plugin-mdx”: “^1.2.14”,
“gatsby-plugin-react-helmet”: “^3.3.6”,
“gatsby-plugin-sharp”: “^2.6.8”,
“gatsby-remark-better-embed-video”: “^2.4.0”,
“gatsby-remark-embed-video”: “^3.0.10”,
“gatsby-remark-images”: “^3.3.7”,
“gatsby-remark-responsive-iframe”: “^2.4.4”,
“gatsby-theme-flex”: “^0.2.5”,
“gatsby-transformer-remark”: “^2.8.14”,
“react”: “^16.13.1”,
“react-dom”: “^16.13.1”,
“react-helmet”: “^6.1.0”
}
}

hi there, try changing your build command to npm run build and see if that works better :+1:

Thanks for your help… Fixed