Error in deployment - Failed during stage 'building site': Build script returned non-zero exit code: 2

7:42:10 PM: Build ready to start
7:42:34 PM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
7:42:34 PM: build-image tag: v4.12.0
7:42:34 PM: buildbot version: c87074660cd9a4568c0ac759bc083987e94204b3
7:42:34 PM: Fetching cached dependencies
7:42:34 PM: Failed to fetch cache, continuing with build
7:42:34 PM: Starting to prepare the repo for build
7:42:34 PM: No cached dependencies found. Cloning fresh repo
7:42:34 PM: git clone GitHub - lucascabralsilvero/IMDb-Clone
7:42:35 PM: Preparing Git Reference refs/heads/master
7:42:35 PM: Parsing package.json dependencies
7:42:36 PM: Starting build script
7:42:36 PM: Installing dependencies
7:42:36 PM: Python version set to 2.7
7:42:36 PM: v16.17.1 is already installed.
7:42:36 PM: Now using node v16.17.1 (npm v8.15.0)
7:42:36 PM: Started restoring cached build plugins
7:42:36 PM: Finished restoring cached build plugins
7:42:37 PM: Attempting ruby version 2.7.2, read from environment
7:42:37 PM: Using ruby version 2.7.2
7:42:37 PM: Using PHP version 8.0
7:42:38 PM: No npm workspaces detected
7:42:38 PM: Started restoring cached node modules
7:42:38 PM: Finished restoring cached node modules
7:42:38 PM: Installing NPM modules using NPM version 8.15.0
7:42:38 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:42:38 PM: npm WARN config location in the cache, and they are managed by
7:42:38 PM: npm WARN config
7:42:38 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:42:38 PM: npm WARN config location in the cache, and they are managed by
7:42:38 PM: npm WARN config cacache.
7:42:42 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on
7:42:44 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
7:42:49 PM: added 1456 packages, and audited 1457 packages in 10s
7:42:49 PM: 210 packages are looking for funding
7:42:49 PM: run npm fund for details
7:42:49 PM: 6 high severity vulnerabilities
7:42:49 PM: To address all issues (including breaking changes), run:
7:42:49 PM: npm audit fix --force
7:42:49 PM: Run npm audit for details.
7:42:49 PM: NPM modules installed
7:42:49 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:42:49 PM: npm WARN config location in the cache, and they are managed by
7:42:49 PM: npm WARN config cacache.
7:42:49 PM: Started restoring cached go cache
7:42:49 PM: Finished restoring cached go cache
7:42:49 PM: Installing Go version 1.17 (requested 1.17)
7:42:58 PM: unset GOOS;
7:42:58 PM: unset GOARCH;
7:42:58 PM: export GOROOT=β€˜/opt/buildhome/.gimme/versions/go1.17.linux.amd64’;
7:42:58 PM: export PATH=β€œ/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}”;
7:42:58 PM: go version >&2;
7:42:58 PM: export GIMME_ENV=β€œ/opt/buildhome/.gimme/env/go1.17.linux.amd64.env”
7:42:58 PM: go version go1.17 linux/amd64
7:42:58 PM: Installing missing commands
7:42:58 PM: Verify run directory
7:42:59 PM: ​
7:42:59 PM: ────────────────────────────────────────────────────────────────
7:42:59 PM: Netlify Build
7:42:59 PM: ────────────────────────────────────────────────────────────────
7:42:59 PM: ​
7:42:59 PM: ❯ Version
7:42:59 PM: @netlify/build 27.20.1
7:42:59 PM: ​
7:42:59 PM: ❯ Flags
7:42:59 PM: baseRelDir: true
7:42:59 PM: buildId: 6345f1422e741f5215187f29
7:42:59 PM: deployId: 6345f1422e741f5215187f2b
7:42:59 PM: ​
7:42:59 PM: ❯ Current directory
7:42:59 PM: /opt/build/repo
7:42:59 PM: ​
7:42:59 PM: ❯ Config file
7:42:59 PM: No config file was defined: using default values.
7:42:59 PM: ​
7:42:59 PM: ❯ Context
7:42:59 PM: production
7:42:59 PM: ​
7:42:59 PM: ────────────────────────────────────────────────────────────────
7:42:59 PM: 1. Build command from Netlify app
7:42:59 PM: ────────────────────────────────────────────────────────────────
7:42:59 PM: ​
7:42:59 PM: $ CI= npm run build
7:42:59 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:42:59 PM: npm WARN config location in the cache, and they are managed by
7:42:59 PM: npm WARN config cacache.
7:42:59 PM: > imdb-clone@0.1.0 build
7:42:59 PM: > react-scripts build
7:43:00 PM: Creating an optimized production build…
7:43:07 PM: Failed to compile.
7:43:07 PM:
7:43:07 PM: Error: Parse Error: <meta
7:43:07 PM: name=β€œdescription”
7:43:07 PM: content=β€œWeb site created using create-react-app”
7:43:07 PM:
7:43:07 PM: />
7:43:07 PM: React App
7:43:07 PM:
7:43:07 PM:
7:43:07 PM: You need to enable JavaScript to run this app.
7:43:07 PM:
7:43:07 PM:


7:43:07 PM:
7:43:07 PM:
7:43:07 PM: - htmlparser.js:255 HTMLParser.parse
7:43:07 PM: [repo]/[html-minifier-terser]/src/htmlparser.js:255:15
7:43:07 PM: - runMicrotasks
7:43:07 PM: - task_queues:96 processTicksAndRejections
7:43:07 PM: node:internal/process/task_queues:96:5
7:43:07 PM: - htmlminifier.js:1282 async minify
7:43:07 PM: [repo]/[html-minifier-terser]/src/htmlminifier.js:1282:3
7:43:07 PM: - htmlminifier.js:1365 async Object.exports.minify
7:43:07 PM: [repo]/[html-minifier-terser]/src/htmlminifier.js:1365:16
7:43:07 PM: ​
7:43:07 PM: ────────────────────────────────────────────────────────────────
7:43:07 PM: β€œbuild.command” failed
7:43:07 PM: ────────────────────────────────────────────────────────────────
7:43:07 PM: ​
7:43:07 PM: Error message
7:43:07 PM: Command failed with exit code 1: CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
7:43:07 PM: ​
7:43:07 PM: Error location
7:43:07 PM: In Build command from Netlify app:
7:43:07 PM: CI= npm run build
7:43:07 PM: ​
7:43:07 PM: Resolved config
7:43:07 PM: build:
7:43:07 PM: command: CI= npm run build
7:43:07 PM: commandOrigin: ui
7:43:07 PM: environment:
7:43:07 PM: - CI
7:43:07 PM: publish: /opt/build/repo/build
7:43:07 PM: publishOrigin: ui
7:43:07 PM: Caching artifacts
7:43:07 PM: Started saving node modules
7:43:07 PM: Finished saving node modules
7:43:07 PM: Started saving build plugins
7:43:07 PM: Finished saving build plugins
7:43:07 PM: Started saving pip cache
7:43:07 PM: Finished saving pip cache
7:43:07 PM: Started saving emacs cask dependencies
7:43:08 PM: Finished saving emacs cask dependencies
7:43:08 PM: Started saving maven dependencies
7:43:08 PM: Finished saving maven dependencies
7:43:08 PM: Started saving boot dependencies
7:43:08 PM: Finished saving boot dependencies
7:43:08 PM: Started saving rust rustup cache
7:43:08 PM: Finished saving rust rustup cache
7:43:08 PM: Started saving go dependencies
7:43:08 PM: Finished saving go dependencies
7:43:09 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:43:09 PM: Creating deploy upload records
7:43:09 PM: Failing build: Failed to build site
7:43:09 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
7:43:09 PM: Finished processing build request in 35.16609387s

Hi @Elunpul

The source of the error outlined above is from the follow lines from public/index.html from your project

    <meta
      name="description"
      content="Web site created using create-react-app"
      <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm" crossorigin="anonymous"/>

    />

What this shows is there is a <link> element inside the <meta> element. The last /> needs to go before the <link>.

1 Like

It works, thank you so much!