0
  • I have deployed react app in netlify from github
  • But the deployment status showing as failed with the presence of error:

Mar 27: failed during stage 'building site': Build script returned non-zero exit code: 1

  • I also tried to deploy app locally from netlify cli, but showing error local build scripts are not found
  • For building local build scripts locally, I executed command npm run build, but the scripts are not build
  • can you guys let at which part I made mistake with your suggestions
  • The github link for the react app is provided below: https://github.com/aarivalagan/sports
  • The detailed log for the react app deployment in netlify is provided below:

4:16:20 PM: Build ready to start
4:16:24 PM: build-image version: 324ec043422499a87b63cac1f1dabeefe6dca19d
4:16:24 PM: build-image tag: v3.0.2
4:16:24 PM: buildbot version: ef2e26260c41679f4cdeaebbf93370345c9fecf7
4:16:24 PM: Fetching cached dependencies
4:16:24 PM: Failed to fetch cache, continuing with build
4:16:24 PM: Starting to prepare the repo for build
4:16:25 PM: No cached dependencies found. Cloning fresh repo
4:16:25 PM: git clone https://github.com/aarivalagan/sports
4:16:25 PM: Preparing Git Reference refs/heads/master
4:16:26 PM: Starting build script
4:16:26 PM: Installing dependencies
4:16:28 PM: v10.15.3 is already installed.
4:16:29 PM: Now using node v10.15.3 (npm v6.4.1)
4:16:29 PM: Attempting ruby version 2.6.2, read from environment
4:16:31 PM: Using ruby version 2.6.2
4:16:31 PM: Using PHP version 5.6
4:16:31 PM: Started restoring cached node modules
4:16:31 PM: Finished restoring cached node modules
4:16:32 PM: Installing NPM modules using NPM version 6.4.1
4:16:37 PM: added 150 packages from 123 contributors and audited 248 packages in 3.856s
4:16:37 PM: found 17 vulnerabilities (7 low, 3 moderate, 7 high)
4:16:37 PM: run npm audit fix to fix them, or npm audit for details
4:16:37 PM: NPM modules installed
4:16:37 PM: Started restoring cached go cache
4:16:37 PM: Finished restoring cached go cache
4:16:37 PM: unset GOOS;
4:16:37 PM: unset GOARCH;
4:16:37 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
4:16:37 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
4:16:37 PM: go version >&2;
4:16:37 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
4:16:37 PM: go version go1.12 linux/amd64
4:16:37 PM: Installing missing commands
4:16:37 PM: Verify run directory
4:16:37 PM: Executing user command: npm run build
4:16:38 PM: npm
4:16:38 PM: ERR!
4:16:38 PM: missing script: build
4:16:38 PM: npm
4:16:38 PM: ERR! A complete log of this run can be found in:
4:16:38 PM: npm ERR!
4:16:38 PM: /opt/buildhome/.npm/_logs/2019-03-27T20_16_38_066Z-debug.log
4:16:38 PM: Caching artifacts
4:16:38 PM: Started saving node modules
4:16:38 PM: Finished saving node modules
4:16:38 PM: Started saving pip cache
4:16:38 PM: Finished saving pip cache
4:16:38 PM: Started saving emacs cask dependencies
4:16:38 PM: Finished saving emacs cask dependencies
4:16:38 PM: Started saving maven dependencies
4:16:38 PM: Finished saving maven dependencies
4:16:38 PM: Started saving boot dependencies
4:16:38 PM: Finished saving boot dependencies
4:16:38 PM: Started saving go dependencies
4:16:38 PM: Finished saving go dependencies
4:16:40 PM: Cached node version v10.15.3
4:16:40 PM: Error running command: Build script returned non-zero exit code: 1
4:16:40 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
4:16:40 PM: Failing build: Failed to build site
4:16:40 PM: Finished processing build request in 16.341987194s
4:16:40 PM: Shutting down logging, 0 messages pending

1
  • Looks like the problem is when it's running npm run build and it can't recognize your build script. Look at the lines after executing user command: npm run build Commented Mar 28, 2019 at 18:47

1 Answer 1

2

There is no command in your package.json (scripts) called build

  "scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build",
    "start": "node ./bin/www"
  },

This app is used for running from node using express server. To deploy to Netlify, you will need it converted to a static site. Netlify hosts static web assets to their CDN. A build command would bundle up all those assets in a folder to be deployed.

Sign up to request clarification or add additional context in comments.

2 Comments

@talves...thanks for your reply...I downloaded application code from github, added build command and ran npm run build comand locally, still I am facing the same issue...can you let me know how could we need to proceed further
@talves...I have taken another react app to deploy in netlify and used express server concept for building scripts...scripts are build and got deployed in netlify...but showing 404 response in the server...this issue I have put as different question and its link.. stackoverflow.com/questions/55418728/… can you kindly look into it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.