Hi there,
I am trying to deploy my personal project via GH to Netlify
Netlify site: https://forkknifewu.netlify.app/
I keep running into a build problem, specifically “Failed during stage ‘building site’: Build script returned non-zero exit code: 2”
I have tried a number of things, including:
- Changing the Build command to “CI= npm run build”
- Adding an environmental variable, “CI” and setting it to “false”
- Changing the build publish directory to “public”
- Adding a “Deploy” script in package.json
None of this seems to work
Link to Build log: Netlify App
Build Settings below:
1:55:29 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
1:55:29 PM: build-image tag: v4.16.1
1:55:29 PM: buildbot version: 9c7f73764568fa60950499e818e0d097bd15af19
1:55:29 PM: Building without cache
1:55:29 PM: Starting to prepare the repo for build
1:55:30 PM: No cached dependencies found. Cloning fresh repo
1:55:30 PM: git clone https://github.com/mich-wu/personal-project
1:55:30 PM: Preparing Git Reference refs/heads/main
1:55:30 PM: Parsing package.json dependencies
1:55:32 PM: Section completed: initializing
1:55:32 PM: Starting build script
1:55:32 PM: Installing dependencies
1:55:32 PM: Python version set to 2.7
1:55:32 PM: v16.19.0 is already installed.
1:55:33 PM: Now using node v16.19.0 (npm v8.19.3)
1:55:33 PM: Enabling node corepack
1:55:33 PM: Started restoring cached build plugins
1:55:33 PM: Finished restoring cached build plugins
1:55:33 PM: Attempting ruby version 2.7.2, read from environment
1:55:33 PM: Using ruby version 2.7.2
1:55:34 PM: Using PHP version 8.0
1:55:34 PM: No npm workspaces detected
1:55:34 PM: Started restoring cached node modules
1:55:34 PM: Finished restoring cached node modules
1:55:34 PM: Installing NPM modules using NPM version 8.19.3
1:55:42 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
1:55:46 PM: added 1141 packages, and audited 1142 packages in 11s
1:55:46 PM: 136 packages are looking for funding
1:55:46 PM: run `npm fund` for details
1:55:46 PM: 3 high severity vulnerabilities
1:55:46 PM: To address all issues, run:
1:55:46 PM: npm audit fix
1:55:46 PM: Run `npm audit` for details.
1:55:46 PM: NPM modules installed
1:55:46 PM: Creating package sha
1:55:46 PM: Started restoring cached go cache
1:55:46 PM: Finished restoring cached go cache
1:55:46 PM: go version go1.19.4 linux/amd64
1:55:46 PM: Detected 0 framework(s)
1:55:46 PM: Installing missing commands
1:55:46 PM: Verify run directory
1:55:48 PM:
1:55:48 PM: ────────────────────────────────────────────────────────────────
1:55:48 PM: Netlify Build
1:55:48 PM: ────────────────────────────────────────────────────────────────
1:55:48 PM:
1:55:48 PM: ❯ Version
1:55:48 PM: @netlify/build 29.1.2
1:55:48 PM:
1:55:48 PM: ❯ Flags
1:55:48 PM: baseRelDir: true
1:55:48 PM: buildId: 639e64fb18290c0f82ff4897
1:55:48 PM: deployId: 639e64fb18290c0f82ff4899
1:55:48 PM:
1:55:48 PM: ❯ Current directory
1:55:48 PM: /opt/build/repo
1:55:48 PM:
1:55:48 PM: ❯ Config file
1:55:48 PM: No config file was defined: using default values.
1:55:48 PM:
1:55:48 PM: ❯ Context
1:55:48 PM: production
1:55:48 PM:
1:55:48 PM: ────────────────────────────────────────────────────────────────
1:55:48 PM: 1. Build command from Netlify app
1:55:48 PM: ────────────────────────────────────────────────────────────────
1:55:48 PM:
1:55:48 PM: $ npm run build
1:55:48 PM: > boilerplate-react-api@0.2.3 build
1:55:48 PM: > npm run webpack
1:55:48 PM: > boilerplate-react-api@0.2.3 webpack
1:55:48 PM: > webpack --config ./client/webpack.config.js
1:55:50 PM: asset bundle.js 1.59 MiB [emitted] (name: main) 1 related asset
1:55:50 PM: runtime modules 2.03 KiB 5 modules
1:55:50 PM: modules by path ./node_modules/ 1.48 MiB 76 modules
1:55:50 PM: modules by path ./client/ 19 KiB
1:55:50 PM: modules by path ./client/components/*.jsx 15.5 KiB 13 modules modules by path ./client/*.js 1.46 KiB ./client/index.js 388 bytes [built] [code generated] + 2 modules modules by path ./client/actions/*.js 889 bytes ./client/actions/locker.js 864 bytes [built] [code generated] ./client/actions/index.js 25 bytes [built] [code generated] ./client/reducers/locker.js 601 bytes [built] [code generated] ./client/apis/locker.js 624 bytes [built] [code generated]semver (ignored) 15 bytes [built] [code generated]./util.inspect (ignored) 15 bytes [built] [code generated]webpack 5.74.0 compiled successfully in 1313 ms
1:55:50 PM: (build.command completed in 2.2s)
1:55:50 PM:
1:55:50 PM: ────────────────────────────────────────────────────────────────
1:55:50 PM: 2. Deploy site
1:55:50 PM: ────────────────────────────────────────────────────────────────
1:55:50 PM:
1:55:50 PM: Section completed: deploying
1:55:50 PM:
1:55:50 PM: ────────────────────────────────────────────────────────────────
1:55:50 PM: Configuration error
1:55:50 PM: ────────────────────────────────────────────────────────────────
1:55:50 PM:
1:55:50 PM: Error message
1:55:50 PM: Deploy did not succeed: Deploy directory 'dist' does not exist
1:55:50 PM:
1:55:50 PM: Resolved config
1:55:50 PM: build:
1:55:50 PM: command: npm run build
1:55:50 PM: commandOrigin: ui
1:55:50 PM: publish: /opt/build/repo/dist
1:55:50 PM: publishOrigin: ui
1:55:50 PM: Caching artifacts
1:55:50 PM: Started saving node modules
1:55:50 PM: Finished saving node modules
1:55:50 PM: Started saving build plugins
1:55:50 PM: Finished saving build plugins
1:55:50 PM: Started saving pip cache
1:55:50 PM: Finished saving pip cache
1:55:50 PM: Started saving emacs cask dependencies
1:55:50 PM: Finished saving emacs cask dependencies
1:55:50 PM: Started saving maven dependencies
1:55:50 PM: Finished saving maven dependencies
1:55:50 PM: Started saving boot dependencies
1:55:50 PM: Finished saving boot dependencies
1:55:50 PM: Started saving rust rustup cache
1:55:50 PM: Finished saving rust rustup cache
1:55:50 PM: Started saving go dependencies
1:55:50 PM: Finished saving go dependencies
1:55:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:55:52 PM: Failing build: Failed to build site
1:55:52 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:55:53 PM: Finished processing build request in 23.244857903s
Any help is appreciated
Thank you