Failed during stage building site: Build script returned non-zero exit code: 1

The site name is didymus7007.netlify.app
This is a react app and I am deploying with netlify for the first time ever.
npm run build works well locally because I get the compiled successfully and other information in my terminal

9:10:00 PM: Build ready to start
9:10:02 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
9:10:02 PM: build-image tag: v3.4.1
9:10:02 PM: buildbot version: 8c957a6d09a03023cea4239847cc73a9cb64eeb7
9:10:03 PM: Fetching cached dependencies
9:10:03 PM: Failed to fetch cache, continuing with build
9:10:03 PM: Starting to prepare the repo for build
9:10:03 PM: No cached dependencies found. Cloning fresh repo
9:10:03 PM: git clone https://github.com/didymus707/my-portfolio
9:10:04 PM: Preparing Git Reference refs/heads/development
9:10:05 PM: Starting build script
9:10:05 PM: Installing dependencies
9:10:05 PM: Python version set to 2.7
9:10:06 PM: v12.18.0 is already installed.
9:10:07 PM: Now using node v12.18.0 (npm v6.14.4)
9:10:07 PM: Started restoring cached build plugins
9:10:07 PM: Finished restoring cached build plugins
9:10:07 PM: Attempting ruby version 2.7.1, read from environment
9:10:08 PM: Using ruby version 2.7.1
9:10:09 PM: Using PHP version 5.6
9:10:09 PM: 5.2 is already installed.
9:10:09 PM: Using Swift version 5.2
9:10:09 PM: Started restoring cached go cache
9:10:09 PM: Finished restoring cached go cache
9:10:09 PM: go version go1.14.4 linux/amd64
9:10:09 PM: go version go1.14.4 linux/amd64
9:10:09 PM: Installing missing commands
9:10:09 PM: Verify run directory
9:10:10 PM: ​
9:10:10 PM: ┌─────────────────────────────┐
9:10:10 PM: │ Netlify Build │
9:10:10 PM: └─────────────────────────────┘
9:10:10 PM: ​
9:10:10 PM: ❯ Version
9:10:10 PM: @netlify/build 3.3.5
9:10:10 PM: ​
9:10:10 PM: ❯ Flags
9:10:10 PM: deployId: 5f63c298957577436afce89b
9:10:10 PM: mode: buildbot
9:10:10 PM: ​
9:10:10 PM: ❯ Current directory
9:10:10 PM: /opt/build/repo
9:10:10 PM: ​
9:10:10 PM: ❯ Config file
9:10:10 PM: No config file was defined: using default values.
9:10:10 PM: ​
9:10:10 PM: ❯ Context
9:10:10 PM: production
9:10:10 PM: ​
9:10:10 PM: ┌───────────────────────────────────┐
9:10:10 PM: │ 1. Build command from Netlify app │
9:10:10 PM: └───────────────────────────────────┘
9:10:10 PM: ​
9:10:10 PM: $ npm run build
9:10:10 PM: npm ERR! code ENOENT
9:10:10 PM: npm ERR! syscall open
9:10:10 PM: npm ERR! path /opt/build/repo/package.json
9:10:10 PM: npm ERR! errno -2
9:10:10 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
9:10:10 PM: npm ERR! enoent This is related to npm not being able to find a file.
9:10:10 PM: npm ERR! enoent
9:10:10 PM: npm ERR! A complete log of this run can be found in:
9:10:10 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-09-17T20_10_10_544Z-debug.log
9:10:10 PM: ​
9:10:10 PM: ┌─────────────────────────────┐
9:10:10 PM: │ “build.command” failed │
9:10:10 PM: └─────────────────────────────┘
9:10:10 PM: ​
9:10:10 PM: Error message
9:10:10 PM: Command failed with exit code 254: npm run build
9:10:10 PM: ​
9:10:10 PM: Error location
9:10:10 PM: In Build command from Netlify app:
9:10:10 PM: npm run build
9:10:10 PM: ​
9:10:10 PM: Resolved config
9:10:10 PM: build:
9:10:10 PM: command: npm run build
9:10:10 PM: commandOrigin: ui
9:10:10 PM: publish: /opt/build/repo/build
9:10:10 PM: Caching artifacts
9:10:10 PM: Started saving build plugins
9:10:10 PM: Finished saving build plugins
9:10:10 PM: Started saving pip cache
9:10:10 PM: Finished saving pip cache
9:10:10 PM: Started saving emacs cask dependencies
9:10:10 PM: Finished saving emacs cask dependencies
9:10:10 PM: Started saving maven dependencies
9:10:10 PM: Finished saving maven dependencies
9:10:10 PM: Started saving boot dependencies
9:10:10 PM: Finished saving boot dependencies
9:10:10 PM: Started saving go dependencies
9:10:10 PM: Finished saving go dependencies
9:10:13 PM: Error running command: Build script returned non-zero exit code: 1
9:10:13 PM: Failing build: Failed to build site
9:10:13 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
9:10:13 PM: Finished processing build request in 11.182315716s

Below is my package.json file

{
  "name": "my-portfolio",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-mdl": "^2.1.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "3.4.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

yep, you are saying to run the command “yarn run build”, but there is no command called “yarn” in the scripts section of your package.json file, so we don’t know what to do.

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

I already changed to use npm run build

ok, can you tell us a little more about what is currently happening? are you still having the same problem after changing your build command? if yes, can you post your package json and your build log again?

also,

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