Why is Deploying a ReactJs site so difficult with Netlify?

PLEASE help us help you by writing a good post!

  • we need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app
  • DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
  • Build problems? Link or paste the FULL build log & build settings screenshot

The better the post - the faster the answer.

I recently posted here - https://answers.netlify.com/t/react-app-not-deploying/34731 about a similar issue where a site would not deploy properly. I have taken that guidance to heart and followed what I did there with this new site build - GitHub - robpedersendev/sannastylesllc: Repo for sanna's salon

My site URL is https://elastic-joliot-b81d54.netlify.app/
My most recent deploy log is Netlify App

The error I keep getting is

12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM:   2. Deploy site                                                
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM: ​
12:03:14 AM: ​
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM:   Configuration error                                           
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM: ​
12:03:14 AM:   Error message
12:03:14 AM:   Deploy did not succeed: Deploy directory 'website/build' does not exist
12:03:14 AM: ​
12:03:14 AM:   Resolved config
12:03:14 AM:   build:
12:03:14 AM:     base: /opt/build/repo/website
12:03:14 AM:     command: npm build
12:03:14 AM:     commandOrigin: ui
12:03:14 AM:     publish: /opt/build/repo/website/build

My .toml file is

[build]

Directory that contains the deploy-ready HTML files and assets generated by

the build. This is relative to the base directory if one has been set, or the

root directory if a base has not been set. This sample publishes the

directory located at the absolute path “root/project/build-output”

publish = "build/"
base = "website/"

I dont know what I am doing wrong, any help would be appreciated

Full build log

12:02:13 AM: Waiting for other deploys from your team to complete
12:02:15 AM: Build ready to start
12:02:16 AM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
12:02:16 AM: build-image tag: v3.7.1
12:02:16 AM: buildbot version: f280013429c5ae8944a8475808a402f217fc3a49
12:02:16 AM: Fetching cached dependencies
12:02:17 AM: Starting to download cache of 74.4MB
12:02:17 AM: Finished downloading cache in 840.776066ms
12:02:17 AM: Starting to extract cache
12:02:19 AM: Finished extracting cache in 1.950826563s
12:02:19 AM: Finished fetching cache in 2.825395749s
12:02:19 AM: Starting to prepare the repo for build
12:02:20 AM: Preparing Git Reference refs/heads/main
12:02:21 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: ‘website’ versus ‘’ in the Netlify UI
12:02:21 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘website/build’ versus ‘’ in the Netlify UI
12:02:21 AM: Starting build script
12:02:21 AM: Installing dependencies
12:02:21 AM: Python version set to 2.7
12:02:22 AM: Started restoring cached node version
12:02:25 AM: Finished restoring cached node version
12:02:25 AM: v12.18.0 is already installed.
12:02:26 AM: Now using node v12.18.0 (npm v6.14.4)
12:02:26 AM: Started restoring cached build plugins
12:02:26 AM: Finished restoring cached build plugins
12:02:26 AM: Attempting ruby version 2.7.1, read from environment
12:02:28 AM: Using ruby version 2.7.1
12:02:28 AM: Using PHP version 5.6
12:02:28 AM: Started restoring cached node modules
12:02:28 AM: Finished restoring cached node modules
12:02:28 AM: Installing NPM modules using NPM version 6.14.4
12:03:05 AM: > core-js@2.6.12 postinstall /opt/build/repo/website/node_modules/babel-runtime/node_modules/core-js
12:03:05 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
12:03:05 AM: > core-js@3.10.0 postinstall /opt/build/repo/website/node_modules/core-js
12:03:05 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
12:03:06 AM: > core-js-pure@3.10.0 postinstall /opt/build/repo/website/node_modules/core-js-pure
12:03:06 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
12:03:06 AM: > ejs@2.7.4 postinstall /opt/build/repo/website/node_modules/ejs
12:03:06 AM: > node ./postinstall.js
12:03:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
12:03:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
12:03:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
12:03:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
12:03:09 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
12:03:09 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
12:03:09 AM: added 1951 packages from 765 contributors and audited 1954 packages in 39.806s
12:03:11 AM: 135 packages are looking for funding
12:03:11 AM: run npm fund for details
12:03:11 AM: found 0 vulnerabilities
12:03:11 AM: NPM modules installed
12:03:11 AM: Started restoring cached go cache
12:03:11 AM: Finished restoring cached go cache
12:03:11 AM: go version go1.14.4 linux/amd64
12:03:11 AM: go version go1.14.4 linux/amd64
12:03:11 AM: Installing missing commands
12:03:11 AM: Verify run directory
12:03:13 AM: ​
12:03:13 AM: ────────────────────────────────────────────────────────────────
12:03:13 AM: Netlify Build
12:03:13 AM: ────────────────────────────────────────────────────────────────
12:03:13 AM: ​
12:03:13 AM: ❯ Version
12:03:13 AM: @netlify/build 10.2.0
12:03:13 AM: ​
12:03:13 AM: ❯ Flags
12:03:13 AM: apiHost: api.netlify.com
12:03:13 AM: cacheDir: /opt/build/cache
12:03:13 AM: deployId: 60665f058ef18900076a886b
12:03:13 AM: mode: buildbot
12:03:13 AM: testOpts:
12:03:13 AM: silentLingeringProcesses: ‘’
12:03:13 AM: ​
12:03:13 AM: ❯ Current directory
12:03:13 AM: /opt/build/repo/website
12:03:13 AM: ​
12:03:13 AM: ❯ Config file
12:03:13 AM: /opt/build/repo/netlify.toml
12:03:13 AM: ​
12:03:13 AM: ❯ Context
12:03:13 AM: production
12:03:13 AM: ​
12:03:13 AM: ────────────────────────────────────────────────────────────────
12:03:13 AM: 1. Build command from Netlify app
12:03:13 AM: ────────────────────────────────────────────────────────────────
12:03:13 AM: ​
12:03:13 AM: $ npm build
12:03:14 AM: npm WARN build npm build called with no arguments. Did you mean to npm run-script build?
12:03:14 AM: ​
12:03:14 AM: (build.command completed in 385ms)
12:03:14 AM: ​
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM: 2. Deploy site
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM: ​
12:03:14 AM: ​
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM: Configuration error
12:03:14 AM: ────────────────────────────────────────────────────────────────
12:03:14 AM: ​
12:03:14 AM: Error message
12:03:14 AM: Deploy did not succeed: Deploy directory ‘website/build’ does not exist
12:03:14 AM: ​
12:03:14 AM: Resolved config
12:03:14 AM: build:
12:03:14 AM: base: /opt/build/repo/website
12:03:14 AM: command: npm build
12:03:14 AM: commandOrigin: ui
12:03:14 AM: publish: /opt/build/repo/website/build
12:03:14 AM: Caching artifacts
12:03:14 AM: Started saving node modules
12:03:14 AM: Finished saving node modules
12:03:14 AM: Started saving build plugins
12:03:14 AM: Finished saving build plugins
12:03:14 AM: Started saving pip cache
12:03:14 AM: Finished saving pip cache
12:03:14 AM: Started saving emacs cask dependencies
12:03:14 AM: Finished saving emacs cask dependencies
12:03:14 AM: Started saving maven dependencies
12:03:14 AM: Finished saving maven dependencies
12:03:14 AM: Started saving boot dependencies
12:03:14 AM: Finished saving boot dependencies
12:03:14 AM: Started saving rust rustup cache
12:03:14 AM: Finished saving rust rustup cache
12:03:14 AM: Started saving go dependencies
12:03:14 AM: Finished saving go dependencies
12:03:14 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:03:14 AM: Failing build: Failed to build site
12:03:14 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
12:03:14 AM: Finished processing build request in 58.04174222s

Your build command should be CI= npm run build or npm run build.

@rob84044 I can confirm this solves the issue, I forked your repo and used npm run build as a build command, it deployed just fine!

Ahh man, I tried to compare it and set it up 1:1. It eats me up it was as simple as that.

I also confirmed it worked. It is now loading. Thank you all.

1 Like