Home
Support Forums

Build.command failed | React JS |

Hello i am facing an error during building my website via dashboard, however it works just fine if I deploy it using CLI. The error that I am facing is :-

3:22:12 AM: Build ready to start
3:22:14 AM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
3:22:14 AM: build-image tag: v3.6.1
3:22:14 AM: buildbot version: 734b021f1afb208e332629f2580fef69fda9a3bc
3:22:14 AM: Fetching cached dependencies
3:22:14 AM: Failed to fetch cache, continuing with build
3:22:14 AM: Starting to prepare the repo for build
3:22:15 AM: No cached dependencies found. Cloning fresh repo
3:22:15 AM: git clone https://github.com/rhlmalik17/Backend-Portolio_Website
3:22:16 AM: Preparing Git Reference refs/heads/release/Production
3:22:17 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘build’ versus ‘./build’ in the Netlify UI
3:22:17 AM: Starting build script
3:22:17 AM: Installing dependencies
3:22:17 AM: Python version set to 2.7
3:22:19 AM: v12.18.0 is already installed.
3:22:20 AM: Now using node v12.18.0 (npm v6.14.4)
3:22:20 AM: Started restoring cached build plugins
3:22:20 AM: Finished restoring cached build plugins
3:22:20 AM: Attempting ruby version 2.7.1, read from environment
3:22:22 AM: Using ruby version 2.7.1
3:22:22 AM: Using PHP version 5.6
3:22:22 AM: Started restoring cached node modules
3:22:22 AM: Finished restoring cached node modules
3:22:23 AM: Installing NPM modules using NPM version 6.14.4
3:22:28 AM: added 115 packages from 195 contributors and audited 115 packages in 4.901s
3:22:29 AM: 1 package is looking for funding
3:22:29 AM: run npm fund for details
3:22:29 AM: found 2 high severity vulnerabilities
3:22:29 AM: run npm audit fix to fix them, or npm audit for details
3:22:29 AM: NPM modules installed
3:22:29 AM: Started restoring cached go cache
3:22:29 AM: Finished restoring cached go cache
3:22:29 AM: go version go1.14.4 linux/amd64
3:22:29 AM: go version go1.14.4 linux/amd64
3:22:29 AM: Installing missing commands
3:22:29 AM: Verify run directory
3:22:32 AM: ​
3:22:32 AM: ────────────────────────────────────────────────────────────────
3:22:32 AM: Netlify Build
3:22:32 AM: ────────────────────────────────────────────────────────────────
3:22:32 AM: ​
3:22:32 AM: ❯ Version
3:22:32 AM: @netlify/build 8.1.0
3:22:32 AM: ​
3:22:32 AM: ❯ Flags
3:22:32 AM: deployId: 600b490cbd7fe43f3d7ec65d
3:22:32 AM: mode: buildbot
3:22:32 AM: ​
3:22:32 AM: ❯ Current directory
3:22:32 AM: /opt/build/repo
3:22:32 AM: ​
3:22:32 AM: ❯ Config file
3:22:32 AM: No config file was defined: using default values.
3:22:32 AM: ​
3:22:32 AM: ❯ Context
3:22:32 AM: production
3:22:32 AM: ​
3:22:32 AM: ────────────────────────────────────────────────────────────────
3:22:32 AM: 1. Build command from Netlify app
3:22:32 AM: ────────────────────────────────────────────────────────────────
3:22:32 AM: ​
3:22:32 AM: $ CI= npm run build
3:22:32 AM: npm ERR! missing script: build
3:22:32 AM: npm ERR! A complete log of this run can be found in:
3:22:32 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-01-22T21_52_32_545Z-debug.log
3:22:32 AM: ​
3:22:32 AM: ────────────────────────────────────────────────────────────────
3:22:32 AM: “build.command” failed
3:22:32 AM: ────────────────────────────────────────────────────────────────
3:22:32 AM: ​
3:22:32 AM: Error message
3:22:32 AM: Command failed with exit code 1: CI= npm run build
3:22:32 AM: ​
3:22:32 AM: Error location
3:22:32 AM: In Build command from Netlify app:
3:22:32 AM: CI= npm run build
3:22:32 AM: ​
3:22:32 AM: Resolved config
3:22:32 AM: build:
3:22:32 AM: command: CI= npm run build
3:22:32 AM: commandOrigin: ui
3:22:32 AM: publish: /opt/build/repo/build
3:22:32 AM: Caching artifacts
3:22:32 AM: Started saving node modules
3:22:32 AM: Finished saving node modules
3:22:32 AM: Started saving build plugins
3:22:32 AM: Finished saving build plugins
3:22:32 AM: Started saving pip cache
3:22:32 AM: Finished saving pip cache
3:22:32 AM: Started saving emacs cask dependencies
3:22:32 AM: Finished saving emacs cask dependencies
3:22:32 AM: Started saving maven dependencies
3:22:33 AM: Finished saving maven dependencies
3:22:33 AM: Started saving boot dependencies
3:22:33 AM: Finished saving boot dependencies
3:22:33 AM: Started saving rust rustup cache
3:22:33 AM: Finished saving rust rustup cache
3:22:33 AM: Started saving go dependencies
3:22:33 AM: Finished saving go dependencies
3:22:36 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:22:36 AM: Failing build: Failed to build site
3:22:36 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
3:22:36 AM: Finished processing build request in 22.057081916s

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!

This probably means that there’s no command in your package.json for build.