Problem with Netlify building

PLEASE help us help you by writing a good post!

  • we need to know your netlify site name. Example:
  • 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
    12:57:43 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)
    12:57:40 PM: Netlify Build
    12:57:40 PM: ────────────────────────────────────────────────────────────────
    12:57:40 PM: ​
    12:57:40 PM: ❯ Version
    12:57:40 PM: @netlify/build 29.20.6
    12:57:40 PM: ​
    12:57:40 PM: ❯ Flags
    12:57:40 PM: baseRelDir: true
    12:57:40 PM: buildId: 64e3430d34dadc032268df1f
    12:57:40 PM: deployId: 64e3430d34dadc032268df21
    12:57:40 PM: ​
    12:57:40 PM: ❯ Current directory
    12:57:40 PM: /opt/build/repo
    12:57:40 PM: ​
    12:57:40 PM: ❯ Config file
    12:57:40 PM: No config file was defined: using default values.
    12:57:40 PM: ​
    12:57:40 PM: ❯ Context
    12:57:40 PM: production
    12:57:40 PM: ​
    12:57:40 PM: Build command from Netlify app
    12:57:40 PM: ────────────────────────────────────────────────────────────────
    12:57:40 PM: ​
    12:57:40 PM: $ npm run build
    12:57:41 PM: > acme-api@1.0.0 build
    12:57:41 PM: > redocly bundle -o dist
    12:57:41 PM: bundling /opt/build/repo/openapi/openapi.yaml…
    12:57:41 PM: :package: Created a bundle for /opt/build/repo/openapi/openapi.yaml at dist.yaml 48ms.
    12:57:41 PM: ​
    12:57:41 PM: (build.command completed in 607ms)
    12:57:41 PM: ​
    12:57:43 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
    12:57:43 PM: Failing build: Failed to build site
    12:57:43 PM: Finished processing build request in 21.289s

The better the post - the faster the answer.
Thank you so much

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!