Failed build for a website made with react & builder.io

So I’m using React & a visual CMS called builder.io to make the front-end of a website. On builder’s website they recommended using netlify for deployment but I’m having issues with the building process. I’m sorry if this is a rookie question but this is my 2nd time deploying a website & my 1st time using this service.

Site Name:

Build Log:

9:30:58 AM: build-image version: 6501259a85bcb5b09824d72c8b1321d814d28904 (focal)
9:30:58 AM: buildbot version: 6501259a85bcb5b09824d72c8b1321d814d28904
9:30:58 AM: Fetching cached dependencies
9:30:58 AM: Failed to fetch cache, continuing with build
9:30:58 AM: Starting to prepare the repo for build
9:30:58 AM: No cached dependencies found. Cloning fresh repo
9:30:58 AM: git clone --filter=blob:none GitHub - AaronBrinkley/Alone-Builder
9:30:59 AM: Preparing Git Reference refs/heads/main
9:30:59 AM: Parsing package.json dependencies
9:31:00 AM: Starting build script
9:31:00 AM: Installing dependencies
9:31:00 AM: Python version set to 2.7
9:31:01 AM: v16.19.0 is already installed.
9:31:01 AM: Now using node v16.19.0 (npm v8.19.3)
9:31:01 AM: Enabling Node.js Corepack
9:31:02 AM: Started restoring cached build plugins
9:31:02 AM: Finished restoring cached build plugins
9:31:02 AM: Attempting Ruby version 2.7.2, read from environment
9:31:02 AM: Using Ruby version 2.7.2
9:31:03 AM: Using PHP version 8.0
9:31:03 AM: Started restoring cached corepack dependencies
9:31:03 AM: mv: cannot move ‘/opt/build/cache/.node/corepack’ to ‘/opt/buildhome/.node/corepack’: No such file or directory
9:31:03 AM: Finished restoring cached corepack dependencies
9:31:03 AM: No npm workspaces detected
9:31:03 AM: Started restoring cached node modules
9:31:03 AM: Finished restoring cached node modules
9:31:03 AM: Bypassing sha validation. Running pre & post install scripts
9:31:03 AM: Installing npm packages using npm version 8.19.3
9:31:08 AM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform’s native performance.now() and performance.timeOrigin.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 MDN: Array.prototype.sort() - JavaScript | MDN
9:31:08 AM: npm WARN deprecated sourcemap-codec@1.4.8: Please use jridgewell/sourcemap-codec instead
9:31:09 AM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use rollup/plugin-terser
9:31:13 AM: npm WARN deprecated svgo1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
9:31:18 AM: added 1499 packages, and audited 1500 packages in 15s
9:31:18 AM: 232 packages are looking for funding
9:31:18 AM: run npm fund for details
9:31:18 AM: 6 high severity vulnerabilities
9:31:18 AM: To address all issues (including breaking changes), run:
9:31:18 AM: npm audit fix --force
9:31:18 AM: Run npm audit for details.
9:31:18 AM: npm packages installed
9:31:18 AM: Started restoring cached go cache
9:31:18 AM: Finished restoring cached go cache
9:31:18 AM: go version go1.19.5 linux/amd64
9:31:18 AM: Detected 1 framework(s)
9:31:19 AM: “create-react-app” at version “5.0.1”
9:31:19 AM: Installing missing commands
9:31:19 AM: Verify run directory
9:31:19 AM: Section completed: initializing
9:31:20 AM: ​
9:31:20 AM: Netlify Build
9:31:20 AM: ────────────────────────────────────────────────────────────────
9:31:20 AM: ​
9:31:20 AM: ❯ Version
9:31:20 AM: @netlify/build 29.5.1
9:31:20 AM: ​
9:31:20 AM: ❯ Flags
9:31:20 AM: baseRelDir: true
9:31:20 AM: buildId: 63da779f0cc95205a0a8e2b9
9:31:20 AM: deployId: 63da779f0cc95205a0a8e2bb
9:31:20 AM: ​
9:31:20 AM: ❯ Current directory
9:31:20 AM: /opt/build/repo
9:31:20 AM: ​
9:31:20 AM: ❯ Config file
9:31:20 AM: No config file was defined: using default values.
9:31:20 AM: ​
9:31:20 AM: ❯ Context
9:31:20 AM: production
9:31:20 AM: ​
9:31:20 AM: 1. Build command from Netlify app
9:31:20 AM: ────────────────────────────────────────────────────────────────
9:31:20 AM: ​
9:31:20 AM: $ npm run build
9:31:20 AM: > my-app@0.1.0 build
9:31:20 AM: > react-scripts build
9:31:21 AM: Creating an optimized production build…
9:31:28 AM:
9:31:28 AM: Treating warnings as errors because process.env.CI = true.
9:31:28 AM: Most CI servers set it automatically.
9:31:28 AM:
9:31:28 AM: Failed to compile.
9:31:28 AM:
9:31:28 AM: [eslint]
9:31:28 AM: src/App.js
9:31:28 AM: Line 11:9: ‘isPreviewingInBuilder’ is assigned a value but never used no-unused-vars
9:31:28 AM: Line 12:10: ‘notFound’ is assigned a value but never used no-unused-vars
9:31:28 AM: Line 28:6: React Hook useEffect has an unnecessary dependency: ‘window.location.pathname’. Either exclude it or remove the dependency array. Outer scope values like ‘window.location.pathname’ aren’t valid dependencies because mutating them doesn’t re-render the component react-hooks/exhaustive-deps
9:31:28 AM: ​
9:31:28 AM: “build.command” failed
9:31:28 AM: ────────────────────────────────────────────────────────────────
9:31:28 AM: ​
9:31:28 AM: Error message
9:31:28 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
9:31:28 AM: ​
9:31:28 AM: Error location
9:31:28 AM: In Build command from Netlify app:
9:31:28 AM: npm run build
9:31:28 AM: ​
9:31:28 AM: Resolved config
9:31:28 AM: build:
9:31:28 AM: command: npm run build
9:31:28 AM: commandOrigin: ui
9:31:28 AM: publish: /opt/build/repo/build
9:31:28 AM: publishOrigin: ui
9:31:29 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
9:31:29 AM: Caching artifacts
9:31:29 AM: Started saving node modules
9:31:29 AM: Finished saving node modules
9:31:29 AM: Started saving build plugins
9:31:29 AM: Finished saving build plugins
9:31:29 AM: Started saving pip cache
9:31:29 AM: Finished saving pip cache
9:31:29 AM: Started saving emacs cask dependencies
9:31:29 AM: Finished saving emacs cask dependencies
9:31:29 AM: Started saving maven dependencies
9:31:29 AM: Finished saving maven dependencies
9:31:29 AM: Started saving boot dependencies
9:31:29 AM: Finished saving boot dependencies
9:31:29 AM: Started saving rust rustup cache
9:31:29 AM: Finished saving rust rustup cache
9:31:29 AM: Started saving go dependencies
9:31:29 AM: Finished saving go dependencies
9:31:29 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:31:29 AM: Failing build: Failed to build site
9:31:29 AM: Finished processing build request in 31.514s
10:53:13 AM: [ERROR] Deploy logs are currently unavailable. We are working on resolving the issue.

Hi @AaronBrinkley

First, have you looked through this resource? It is a compilation of all of our build and deploy resources.

(post deleted by author)

I haven’t yet. I’m reading it now.

@AaronBrinkley If you haven’t self solved your issue is:

9:31:28 AM: Treating warnings as errors because process.env.CI = true.
9:31:28 AM: Most CI servers set it automatically.

Then these warnings being treated as errors and causing the build to fail:

9:31:28 AM: Line 11:9: ‘isPreviewingInBuilder’ is assigned a value but never used no-unused-vars
9:31:28 AM: Line 12:10: ‘notFound’ is assigned a value but never used no-unused-vars
9:31:28 AM: Line 28:6: React Hook useEffect has an unnecessary dependency: ‘window.location.pathname’. Either exclude it or remove the dependency array. Outer scope values like ‘window.location.pathname’ aren’t valid dependencies because mutating them doesn’t re-render the component react-hooks/exhaustive-deps

Your build command is:

9:31:20 AM: $ npm run build

You want to ensure that CI is false so that warnings are not treated as errors.

One way to do this is by changing your Build command to:

CI= npm run build
1 Like

Thank you, I got it fixed. But now my page is showing up as blank when I see it deployed.

@AaronBrinkley That just looks like your project to me.

If I pull down your repository and do an npm run build then go into the build folder and run npx serve to serve the files I see the same in my browser.

It’s also what I see when I use npm run develop.

1 Like

I forgot to mention that I’m using a visual editor from a site called builder.io. I see content for website when I preview it there or start my local server with npm start but not when it’s deployed.

@AaronBrinkley That won’t matter much to Netlify though, which is pulling the code from the repository and running it according to your Build settings.

If it doesn’t work when you pull the repository code locally and execute it with those same settings, then it won’t work on Netlify.

So the goal would be debugging your build until you’re able to see it execute locally, and/or ensuring the settings are whatever is required by builder.io.

1 Like

Hi I would encourage you to debug your code. heres a good guide to start with when debugging your code [Support Guide] Debugging Netlify site builds

1 Like