Command failed with exit code 1: gatsby build

────────────────────────────────────────────────────────────────
    10:29:29 AM:   "build.command" failed                                        
    10:29:29 AM: ────────────────────────────────────────────────────────────────
    10:29:29 AM: ​
    10:29:29 AM:   Error message
    10:29:29 AM:   Command failed with exit code 1: gatsby build
    10:29:29 AM: ​
    10:29:29 AM:   Error location
    10:29:29 AM:   In Build command from Netlify app:
    10:29:29 AM:   gatsby build
    10:29:29 AM: ​
    10:29:29 AM:   Resolved config
    10:29:29 AM:   build:
    10:29:29 AM:     command: gatsby build
    10:29:29 AM:     commandOrigin: ui
    10:29:29 AM:     publish: /opt/build/repo/public
    10:29:29 AM: Caching artifacts
    10:29:29 AM: Started saving node modules
    10:29:29 AM: Finished saving node modules
    10:29:29 AM: Started saving build plugins
    10:29:29 AM: Finished saving build plugins
    10:29:29 AM: Started saving pip cache
    10:29:30 AM: Finished saving pip cache
    10:29:30 AM: Started saving emacs cask dependencies
    10:29:30 AM: Finished saving emacs cask dependencies
    10:29:30 AM: Started saving maven dependencies
    10:29:30 AM: Finished saving maven dependencies
    10:29:30 AM: Started saving boot dependencies
    10:29:30 AM: Finished saving boot dependencies
    10:29:30 AM: Started saving go dependencies
    10:29:30 AM: Finished saving go dependencies
    10:29:30 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
    10:29:30 AM: Failing build: Failed to build site
    10:29:30 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
    10:29:30 AM: Finished processing build request in 57.885134762s
    10:28:30 AM: Build ready to start
    10:28:32 AM: build-image version: 09c2cdcdf242cf2f57c9ee0fcad9d298fad9ad41
    10:28:32 AM: build-image tag: v3.5.0
    10:28:32 AM: buildbot version: 172aa31cb336bae73f9eb30159b9f95fe46f2e63
    10:28:32 AM: Fetching cached dependencies
    10:28:32 AM: Starting to download cache of 161.5MB
    10:28:34 AM: Finished downloading cache in 1.735479373s
    10:28:34 AM: Starting to extract cache
    10:28:39 AM: Finished extracting cache in 5.56001848s
    10:28:39 AM: Finished fetching cache in 7.332809157s
    10:28:39 AM: Starting to prepare the repo for build
    10:28:40 AM: Preparing Git Reference refs/heads/master
    10:28:41 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
    10:28:41 AM: Starting build script
    10:28:42 AM: Installing dependencies
    10:28:42 AM: Python version set to 2.7
    10:28:42 AM: Started restoring cached node version
    10:28:44 AM: Finished restoring cached node version
    10:28:45 AM: v12.18.0 is already installed.
    10:28:46 AM: Now using node v12.18.0 (npm v6.14.4)
    10:28:46 AM: Started restoring cached build plugins
    10:28:46 AM: Finished restoring cached build plugins
    10:28:46 AM: Attempting ruby version 2.7.1, read from environment
    10:28:47 AM: Using ruby version 2.7.1
    10:28:47 AM: Using PHP version 5.6
    10:28:47 AM: Started restoring cached node modules
    10:28:47 AM: Finished restoring cached node modules
    10:28:47 AM: Installing NPM modules using NPM version 6.14.4
    10:29:00 AM: > @fortawesome/fontawesome-common-types@0.2.32 postinstall /opt/build/repo/node_modules/@fortawesome/fontawesome-common-types
    10:29:00 AM: > node attribution.js
    10:29:01 AM: Font Awesome Free 0.2.32 by @fontawesome - https://fontawesome.com
    10:29:01 AM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    10:29:01 AM: > @fortawesome/fontawesome-svg-core@1.2.32 postinstall /opt/build/repo/node_modules/@fortawesome/fontawesome-svg-core
    10:29:01 AM: > node attribution.js
    10:29:01 AM: Font Awesome Free 1.2.32 by @fontawesome - https://fontawesome.com
    10:29:01 AM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    10:29:01 AM: > @fortawesome/free-brands-svg-icons@5.15.1 postinstall /opt/build/repo/node_modules/@fortawesome/free-brands-svg-icons
    10:29:01 AM: > node attribution.js
    10:29:01 AM: Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
    10:29:01 AM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    10:29:01 AM: > @fortawesome/free-solid-svg-icons@5.15.1 postinstall /opt/build/repo/node_modules/@fortawesome/free-solid-svg-icons
    10:29:01 AM: > node attribution.js
    10:29:01 AM: Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
    10:29:01 AM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    10:29:03 AM: npm WARN ts-node@9.0.0 requires a peer of typescript@>=2.7 but none is installed. You must install peer dependencies yourself.
    10:29:03 AM: npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
    10:29:03 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/chokidar/node_modules/fsevents):
    10:29:03 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    10:29:03 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
    10:29:03 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    10:29:03 AM: added 4 packages from 6 contributors and audited 2222 packages in 14.36s
    10:29:04 AM: 148 packages are looking for funding
    10:29:04 AM:   run `npm fund` for details
    10:29:04 AM: found 0 vulnerabilities
    10:29:04 AM: NPM modules installed
    10:29:04 AM: Started restoring cached go cache
    10:29:04 AM: Finished restoring cached go cache
    10:29:04 AM: go version go1.14.4 linux/amd64
    10:29:04 AM: go version go1.14.4 linux/amd64
    10:29:04 AM: Installing missing commands
    10:29:04 AM: Verify run directory
    10:29:06 AM: ​
    10:29:06 AM: ────────────────────────────────────────────────────────────────
    10:29:06 AM:   Netlify Build                                                 
    10:29:06 AM: ────────────────────────────────────────────────────────────────
    10:29:06 AM: ​
    10:29:06 AM: ❯ Version
    10:29:06 AM:   @netlify/build 5.3.2
    10:29:06 AM: ​
    10:29:06 AM: ❯ Flags
    10:29:06 AM:   deployId: 5fbb80beaf52a000070afe3b
    10:29:06 AM:   mode: buildbot
    10:29:06 AM: ​
    10:29:06 AM: ❯ Current directory
    10:29:06 AM:   /opt/build/repo
    10:29:06 AM: ​
    10:29:06 AM: ❯ Config file
    10:29:06 AM:   No config file was defined: using default values.
    10:29:06 AM: ​
    10:29:06 AM: ❯ Context
    10:29:06 AM:   production
    10:29:06 AM: ​
    10:29:06 AM: ────────────────────────────────────────────────────────────────
    10:29:06 AM:   1. Build command from Netlify app                             
    10:29:06 AM: ────────────────────────────────────────────────────────────────
    10:29:06 AM: ​
    10:29:06 AM: $ gatsby build
    10:29:09 AM: success open and validate gatsby-configs - 0.019s
    10:29:10 AM: success load plugins - 0.597s
    10:29:10 AM: success onPreInit - 0.041s
    10:29:10 AM: success delete html and css files from previous builds - 0.003s
    10:29:10 AM: success initialize cache - 0.008s
    10:29:10 AM: success copy gatsby files - 0.042s
    10:29:10 AM: success onPreBootstrap - 0.021s
    10:29:10 AM: success createSchemaCustomization - 0.005s
    10:29:10 AM: success Checking for changed pages - 0.000s
    10:29:10 AM: success source and transform nodes - 0.142s
    10:29:10 AM: success building schema - 0.347s
    10:29:10 AM: info Total nodes: 44, SitePage nodes: 1 (use --verbose for breakdown)
    10:29:10 AM: success createPages - 0.001s
    10:29:10 AM: success Checking for changed pages - 0.000s
    10:29:11 AM: success createPagesStatefully - 0.073s
    10:29:11 AM: success update schema - 0.038s
    10:29:11 AM: success onPreExtractQueries - 0.000s
    10:29:11 AM: success extract queries from components - 0.552s
    10:29:11 AM: success write out redirect data - 0.001s
    10:29:11 AM: success onPostBootstrap - 0.000s
    10:29:11 AM: info bootstrap finished - 5.090s
    10:29:12 AM: success run static queries - 0.904s - 1/1 1.11/s
    10:29:13 AM: success run page queries - 1.175s - 2/2 1.70/s
    10:29:13 AM: success write out requires - 0.013s
    10:29:29 AM: failed Building production JavaScript and CSS bundles - 15.897s
    10:29:29 AM: error Generating JavaScript bundles failed
    10:29:29 AM: Can't resolve '@fortawesome/react-fontawesome' in '/opt/build/repo/src/pages'
    10:29:29 AM: If you're trying to use a package make sure that '@fortawesome/react-fontawesome' is installed. If you're trying to use a local file make sure that the path is correct.
    10:29:29 AM: not finished Generating image thumbnails - 17.978s
    10:29:29 AM: ​
    10:29:29 AM: ────────────────────────────────────────────────────────────────
    10:29:29 AM:   "build.command" failed                                        
    10:29:29 AM: ────────────────────────────────────────────────────────────────
    10:29:29 AM: ​
    10:29:29 AM:   Error message
    10:29:29 AM:   Command failed with exit code 1: gatsby build
    10:29:29 AM: ​
    10:29:29 AM:   Error location
    10:29:29 AM:   In Build command from Netlify app:
    10:29:29 AM:   gatsby build
    10:29:29 AM: ​
    10:29:29 AM:   Resolved config
    10:29:29 AM:   build:
    10:29:29 AM:     command: gatsby build
    10:29:29 AM:     commandOrigin: ui
    10:29:29 AM:     publish: /opt/build/repo/public
    10:29:29 AM: Caching artifacts
    10:29:29 AM: Started saving node modules
    10:29:29 AM: Finished saving node modules
    10:29:29 AM: Started saving build plugins
    10:29:29 AM: Finished saving build plugins
    10:29:29 AM: Started saving pip cache
    10:29:30 AM: Finished saving pip cache
    10:29:30 AM: Started saving emacs cask dependencies
    10:29:30 AM: Finished saving emacs cask dependencies
    10:29:30 AM: Started saving maven dependencies
    10:29:30 AM: Finished saving maven dependencies
    10:29:30 AM: Started saving boot dependencies
    10:29:30 AM: Finished saving boot dependencies
    10:29:30 AM: Started saving go dependencies
    10:29:30 AM: Finished saving go dependencies
    10:29:30 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
    10:29:30 AM: Failing build: Failed to build site
    10:29:30 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
    10:29:30 AM: Finished processing build request in 57.885134762s "

package.json is also below.

 {

"name": "gatsby-starter-hello-world",

"private": true,

"description": "A simplified bare-bones starter for Gatsby",

"version": "0.1.0",

"license": "0BSD",

"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"

},

"dependencies": {

"@fortawesome/fontawesome-svg-core": "^1.2.32",

"@fortawesome/free-brands-svg-icons": "^5.15.1",

"@fortawesome/free-solid-svg-icons": "^5.15.1",

"gatsby": "^2.26.1",

"gatsby-image": "^2.5.0",

"gatsby-plugin-sharp": "^2.8.0",

"gatsby-source-filesystem": "^2.5.0",

"gatsby-transformer-sharp": "^2.6.0",

"react": "^16.12.0",

"react-dom": "^16.12.0"

},

"devDependencies": {

"prettier": "2.1.2"

},

"repository": {

"type": "git",

"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"

},

"bugs": {

"url": "https://github.com/gatsbyjs/gatsby/issues"

}
}

what I tried was
*I wrote “npm run build” in terminal instead of “gatsby build” (Build Error "build.command" failed exit code 127: gatsby build - #3 by markymarkaz)

  • deleted cache and try to deploy again