title: Netlify Deployment failed with React
body: <p>My Netlify Deployment is failed due to build issue :
  I m trying to deploy this site directly from my Github repository.</p>
  <p>Here is the complete log :</p>
  <pre><code>4:03:47 PM: Build ready to start
  4:03:49 PM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302
  4:03:49 PM: build-image tag: v3.7.6
  4:03:49 PM: buildbot version: 96f6c6faf398b8f2b7e39c2c3c6a03ac4592e535
  4:03:49 PM: Fetching cached dependencies
  4:03:49 PM: Failed to fetch cache, continuing with build
  4:03:49 PM: Starting to prepare the repo for build
  4:03:50 PM: No cached dependencies found. Cloning fresh repo
  4:03:50 PM: git clone https://github.com/Ashumaurya/sorting
  4:03:50 PM: Preparing Git Reference refs/heads/master
  4:03:51 PM: Parsing package.json dependencies
  4:03:52 PM: Starting build script
  4:03:52 PM: Installing dependencies
  4:03:52 PM: Python version set to 2.7
  4:03:53 PM: Downloading and installing node v10.11.0...
  4:03:53 PM: Downloading https://nodejs.org/dist/v10.11.0/node-v10.11.0-linux-x64.tar.xz...
  4:03:54 PM: Computing checksum with sha256sum
  4:03:54 PM: Checksums matched!
  4:03:56 PM: Now using node v10.11.0 (npm v6.4.1)
  4:03:56 PM: Started restoring cached build plugins
  4:03:56 PM: Finished restoring cached build plugins
  4:03:56 PM: Attempting ruby version 2.7.1, read from environment
  4:03:57 PM: Using ruby version 2.7.1
  4:03:57 PM: Using PHP version 5.6
  4:03:57 PM: Started restoring cached node modules
  4:03:57 PM: Finished restoring cached node modules
  4:03:58 PM: Installing NPM modules using NPM version 6.4.1
  4:04:24 PM: &gt; core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
  4:04:25 PM: &gt; node -e &quot;try{require('./postinstall')}catch(e){}&quot;
  4:04:25 PM: &gt; core-js@3.8.2 postinstall /opt/build/repo/node_modules/core-js
  4:04:25 PM: &gt; node -e &quot;try{require('./postinstall')}catch(e){}&quot;
  4:04:25 PM: &gt; core-js-pure@3.8.2 postinstall /opt/build/repo/node_modules/core-js-pure
  4:04:25 PM: &gt; node -e &quot;try{require('./postinstall')}catch(e){}&quot;
  4:04:25 PM: &gt; ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
  4:04:25 PM: &gt; node ./postinstall.js
  4:04:27 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
  4:04:27 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})
  4:04:27 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
  4:04:27 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})
  4:04:27 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
  4:04:27 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})
  4:04:27 PM: added 1979 packages from 762 contributors and audited 1982 packages in 28.912s
  4:04:27 PM: found 1269 vulnerabilities (170 moderate, 1099 high)
  4:04:27 PM:   run `npm audit fix` to fix them, or `npm audit` for details
  4:04:27 PM: NPM modules installed
  4:04:27 PM: Started restoring cached go cache
  4:04:27 PM: Finished restoring cached go cache
  4:04:27 PM: go version go1.14.4 linux/amd64
  4:04:27 PM: go version go1.14.4 linux/amd64
  4:04:27 PM: Installing missing commands
  4:04:27 PM: Verify run directory
  4:04:29 PM: ​
  4:04:29 PM: ────────────────────────────────────────────────────────────────
  4:04:29 PM:   Netlify Build                                                 
  4:04:29 PM: ────────────────────────────────────────────────────────────────
  4:04:29 PM: ​
  4:04:29 PM: ❯ Version
  4:04:29 PM:   @netlify/build 11.18.0
  4:04:29 PM: ​
  4:04:29 PM: ❯ Flags
  4:04:29 PM:   deployId: 60aa2f8b1d35c500072a653d
  4:04:29 PM: ​
  4:04:29 PM: ❯ Current directory
  4:04:29 PM:   /opt/build/repo
  4:04:29 PM: ​
  4:04:29 PM: ❯ Config file
  4:04:29 PM:   /opt/build/repo/netlify.toml
  4:04:29 PM: ​
  4:04:29 PM: ❯ Context
  4:04:29 PM:   production
  4:04:29 PM: ​
  4:04:29 PM: ────────────────────────────────────────────────────────────────
  4:04:29 PM:   1. Build command from Netlify app                             
  4:04:29 PM: ────────────────────────────────────────────────────────────────
  4:04:29 PM: ​
  4:04:29 PM: $ npm run build
  4:04:29 PM: &gt; sorting@0.1.0 build /opt/build/repo
  4:04:29 PM: &gt; react-scripts build
  4:04:31 PM: Creating an optimized production build...
  4:04:42 PM: Failed to compile.
  4:04:42 PM: 
  4:04:42 PM: createRequire is not a function
  4:04:42 PM: Referenced from: BaseConfig
  4:04:42 PM: npm ERR! code ELIFECYCLE
  4:04:42 PM: npm ERR! errno 1
  4:04:42 PM: npm ERR! sorting@0.1.0 build: `react-scripts build`
  4:04:42 PM: npm ERR! Exit status 1
  4:04:42 PM: npm ERR!
  4:04:42 PM: npm ERR! Failed at the sorting@0.1.0 build script.
  4:04:42 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  4:04:42 PM: npm ERR! A complete log of this run can be found in:
  4:04:42 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-05-23T10_34_42_160Z-debug.log
  4:04:42 PM: ​
  4:04:42 PM: ────────────────────────────────────────────────────────────────
  4:04:42 PM:   &quot;build.command&quot; failed                                        
  4:04:42 PM: ────────────────────────────────────────────────────────────────
  4:04:42 PM: ​
  4:04:42 PM:   Error message
  4:04:42 PM:   Command failed with exit code 1: npm run build
  4:04:42 PM: ​
  4:04:42 PM:   Error location
  4:04:42 PM:   In Build command from Netlify app:
  4:04:42 PM:   npm run build
  4:04:42 PM: ​
  4:04:42 PM:   Resolved config
  4:04:42 PM:   build:
  4:04:42 PM:     command: npm run build
  4:04:42 PM:     commandOrigin: ui
  4:04:42 PM:     environment:
  4:04:42 PM:       - NODE_VERSION
  4:04:42 PM:       - YARN_VERSION
  4:04:42 PM:       - NPM_VERSION
  4:04:42 PM:     publish: /opt/build/repo/build
  4:04:42 PM: Caching artifacts
  4:04:42 PM: Started saving node modules
  4:04:42 PM: Finished saving node modules
  4:04:42 PM: Started saving build plugins
  4:04:42 PM: Finished saving build plugins
  4:04:42 PM: Started saving pip cache
  4:04:42 PM: Finished saving pip cache
  4:04:42 PM: Started saving emacs cask dependencies
  4:04:42 PM: Finished saving emacs cask dependencies
  4:04:42 PM: Started saving maven dependencies
  4:04:42 PM: Finished saving maven dependencies
  4:04:42 PM: Started saving boot dependencies
  4:04:42 PM: Finished saving boot dependencies
  4:04:42 PM: Started saving rust rustup cache
  4:04:42 PM: Finished saving rust rustup cache
  4:04:42 PM: Started saving go dependencies
  4:04:42 PM: Finished saving go dependencies
  4:04:45 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
  4:04:45 PM: Creating deploy upload records
  4:04:46 PM: Failing build: Failed to build site
  4:04:46 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
  4:04:46 PM: Finished processing build request in 56.362135788s
  </code></pre>
  <p>and here is My Package.json :</p>
  <pre><code>{
    &quot;name&quot;: &quot;sorting&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@babel/core&quot;: &quot;^7.14.3&quot;,
      &quot;@testing-library/jest-dom&quot;: &quot;^5.11.8&quot;,
      &quot;@testing-library/react&quot;: &quot;^11.2.3&quot;,
      &quot;@testing-library/user-event&quot;: &quot;^12.6.0&quot;,
      &quot;babel-eslint&quot;: &quot;^10.1.0&quot;,
      &quot;emailjs-com&quot;: &quot;^2.6.4&quot;,
      &quot;eslint-config-react-app&quot;: &quot;^6.0.0&quot;,
      &quot;react&quot;: &quot;^17.0.1&quot;,
      &quot;react-dom&quot;: &quot;^17.0.1&quot;,
      &quot;react-router-dom&quot;: &quot;^5.2.0&quot;,
      &quot;react-scripts&quot;: &quot;4.0.1&quot;,
      &quot;typescript&quot;: &quot;^4.2.4&quot;,
      &quot;web-vitals&quot;: &quot;^0.2.4&quot;
    },
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;react-scripts start&quot;,
      &quot;build&quot;: &quot;react-scripts build&quot;,
      &quot;test&quot;: &quot;react-scripts test&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;
    },
    &quot;eslintConfig&quot;: {
      &quot;extends&quot;: [
        &quot;react-app&quot;,
        &quot;react-app/jest&quot;
      ]
    },
    &quot;browserslist&quot;: {
      &quot;production&quot;: [
        &quot;&gt;0.2%&quot;,
        &quot;not dead&quot;,
        &quot;not op_mini all&quot;
      ],
      &quot;development&quot;: [
        &quot;last 1 chrome version&quot;,
        &quot;last 1 firefox version&quot;,
        &quot;last 1 safari version&quot;
      ]
    }
  }
  </code></pre>
  <p>I tried couple of things but it didn't worked. It would be really helpful if someone can explain me what is the error and how to solve it.
  Thankyou</p>