Help with deploying on netlify

All of the online youtube tutorials make deploying seem really simple, but I can’t get it to work.
My github repository is called ‘Emily-portfolio-site’, but then i cd into ‘my-portoflio’ folder- the react app created in that repository.
From the ‘my-portfolio’ i ran ‘yarn run build’, ‘yarn global add serve’, ‘serve -s build’. I then came onto netlify to try and deploy which should be quick and simple by selecting the github file, selecting master branch, build command: ‘npm run build’, publish directory: ‘build/’ . It failed. I wondered at first if it was because it was trying to deploy from ‘Emily-portfolio-site’ and not the file within that which contains all the React app bits. But I have tried a few different ways and have failed. Please could you help me. It should be so simple…

hey emily, sorry to hear you are having trouble.

First, did you see this post?

it might contain some tips that you’ll find helpful.

If still no luck, can you please paste or link to the most recent build log please? (instructions in that article).

I’m sure we can get this working! :muscle:

Thanks for this. I had a look at which versions of things I have. I suppose it doesnt matter having slighty newer versions? I had a look at the deploy log anyway, and it got stuck on building part. This was the error message: 5:53:05 PM: Error running command: Build script returned non-zero exit code: 127.
I understand thats probably not helpful in the slightest…

hi, can you post the full build log please?

hiya.
Do you mean all of this?

5:52:51 PM: Build ready to start

5:52:53 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774

5:52:53 PM: build-image tag: v3.3.7

5:52:53 PM: buildbot version: 11918e084194721d200458438c92ff8180b3b56c

5:52:54 PM: Fetching cached dependencies

5:52:54 PM: Failed to fetch cache, continuing with build

5:52:54 PM: Starting to prepare the repo for build

5:52:54 PM: No cached dependencies found. Cloning fresh repo

5:52:54 PM: git clone https://github.com/ehayne00/Emily-portfolio-site

5:52:55 PM: Preparing Git Reference refs/heads/master

5:52:55 PM: Starting build script

5:52:55 PM: Installing dependencies

5:52:57 PM: v10.19.0 is already installed.

5:52:58 PM: Now using node v10.19.0 (npm v6.13.4)

5:52:58 PM: Attempting ruby version 2.6.2, read from environment

5:53:00 PM: Using ruby version 2.6.2

5:53:00 PM: Using PHP version 5.6

5:53:00 PM: Started restoring cached go cache

5:53:00 PM: Finished restoring cached go cache

5:53:00 PM: unset GOOS;

5:53:00 PM: unset GOARCH;

5:53:00 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';

5:53:00 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";

5:53:00 PM: go version >&2;

5:53:00 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';

5:53:00 PM: go version go1.12 linux/amd64

5:53:00 PM: Installing missing commands

5:53:00 PM: Verify run directory

5:53:00 PM: Executing user command: run npm build

5:53:00 PM: /usr/local/bin/build: line 112: run: command not found

5:53:00 PM: Skipping functions preparation step: no functions directory set

5:53:00 PM: Caching artifacts

5:53:00 PM: Started saving pip cache

5:53:00 PM: Finished saving pip cache

5:53:00 PM: Started saving emacs cask dependencies

5:53:00 PM: Finished saving emacs cask dependencies

5:53:00 PM: Started saving maven dependencies

5:53:00 PM: Finished saving maven dependencies

5:53:00 PM: Started saving boot dependencies

5:53:00 PM: Finished saving boot dependencies

5:53:00 PM: Started saving go dependencies

5:53:00 PM: Finished saving go dependencies

5:53:05 PM: Error running command: Build script returned non-zero exit code: 127

5:53:05 PM: Failing build: Failed to build site

5:53:05 PM: failed during stage 'building site': Build script returned non-zero exit code: 127

5:53:05 PM: Finished processing build request in 11.526992603s

yes, that’s what i wanted to see. can you post your package.json and a screenshot of your build settings too please?

apologies for late reply! I’ve had alot of work on. Very grateful for your help.

Here is what the package.json looks like…

{
  "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",
    "acorn": "^7.1.1",
    "animate.css": "^3.7.2",
    "bootstrap": "^4.4.1",
    "greensock": "^1.20.2",
    "gsap": "^3.2.6",
    "minimist": "^1.2.5",
    "react": "^16.13.0",
    "react-dom": "^16.13.0",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.0"
  },
  "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"
    ]
  }
}

and when you say build settings, you mean what I’d put on netlify prior to deployment?

I tried both of these, but it still fails on the same bit- the build script returned non-zero exit code: 127

hi Emily, I think that the settings in the upper screenshot will work better than the lower one.

If you look at the package.json, you’ll see that the tasks that are actually defined are:

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

but in your build settings you are trying to execute

run npm build which isn’t defined. I believe you may have transposed the commands.

will you try npm run build instead, please? This is saying “hey npm, run the build command”, which is defined in your package.json that might work better. we might still have to tweak your directory settings but we’ll deal with that next.