Deploy failed: Build failed due to a user error: Build script returned non-zero exit code: 2

Site name for the build: marvelous-gingersnap-8638fb

Hello, I try to deploy a simple web site page But the build failed on deploy, and i can’t tell what exactly is the issue in the build log below:

11:17:43 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)
11:17:23 AM: build-image version: 2be2d5ea7334df8a1466155c1fa6d24c44c0ab32 (focal)
11:17:23 AM: buildbot version: 15139f5b7c24ad053b720a7e105157d947f16900
11:17:23 AM: Fetching cached dependencies
11:17:23 AM: Failed to fetch cache, continuing with build
11:17:23 AM: Starting to prepare the repo for build
11:17:24 AM: No cached dependencies found. Cloning fresh repo
11:17:24 AM: git clone --filter=blob:none GitHub - ShueiYang/deliveroo-solid: Deliveroo clone on the Rambuteau page (Solid.js version)
11:17:24 AM: Preparing Git Reference refs/heads/main
11:17:26 AM: Starting to install dependencies
11:17:26 AM: Python version set to 3.8
11:17:26 AM: Attempting Ruby version 2.7.2, read from environment
11:17:26 AM: Using Ruby version 2.7.2
11:17:27 AM: Started restoring cached go cache
11:17:27 AM: Finished restoring cached go cache
11:17:27 AM: go version go1.19.10 linux/amd64
11:17:27 AM: Using PHP version 8.0
11:17:28 AM: v18.16.1 is already installed.
11:17:28 AM: Now using node v18.16.1 (npm v9.5.1)
11:17:28 AM: Enabling Node.js Corepack
11:17:29 AM: Started restoring cached build plugins
11:17:29 AM: Finished restoring cached build plugins
11:17:29 AM: Started restoring cached corepack dependencies
11:17:29 AM: Finished restoring cached corepack dependencies
11:17:29 AM: Found pnpm version (7.13.4) that doesn’t match expected ()
Usage Error: Invalid package manager specification in CLI arguments; expected a semver version, range, or tag
11:17:29 AM: $ corepack prepare [–activate] [–all] [–json] [-o,–output] …
11:17:29 AM: No pnpm workspaces detected
11:17:29 AM: Started restoring cached node modules
11:17:29 AM: Finished restoring cached node modules
11:17:29 AM: Installing npm packages using pnpm version 7.13.4
11:17:30 AM: WARN Ignoring not compatible lockfile at /opt/build/repo/pnpm-lock.yaml
11:17:30 AM: Progress: resolved 1, reused 0, downloaded 0, added 0
11:17:31 AM: Progress: resolved 27, reused 0, downloaded 9, added 0
11:17:32 AM: Progress: resolved 88, reused 0, downloaded 67, added 0
11:17:33 AM: Progress: resolved 175, reused 0, downloaded 141, added 0
11:17:34 AM: Progress: resolved 235, reused 0, downloaded 188, added 0
11:17:35 AM: Progress: resolved 368, reused 0, downloaded 330, added 0
11:17:35 AM: Packages: +347
11:17:35 AM: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11:17:35 AM: Packages are hard linked from the content-addressable store to the virtual store.
11:17:35 AM: Content-addressable store is at: /opt/build/.pnpm-store/v3
11:17:35 AM: Virtual store is at: node_modules/.pnpm
11:17:36 AM: …/esbuild@0.18.12/node_modules/esbuild postinstall$ node install.js
11:17:36 AM: …/esbuild@0.18.12/node_modules/esbuild postinstall: Done
11:17:36 AM: Progress: resolved 369, reused 0, downloaded 347, added 347, done
11:17:36 AM: dependencies:
11:17:36 AM: + solid-js 1.7.8
11:17:36 AM: devDependencies:
11:17:36 AM: + @typescript-eslint/eslint-plugin 5.62.0 (6.0.0 is available)
11:17:36 AM: + @typescript-eslint/parser 5.62.0 (6.0.0 is available)
11:17:36 AM: + autoprefixer 10.4.14
11:17:36 AM: + eslint 8.44.0
11:17:36 AM: + eslint-plugin-solid 0.12.1
11:17:36 AM: + postcss 8.4.25
11:17:36 AM: + solid-devtools 0.27.3
11:17:36 AM: + tailwindcss 3.3.2
11:17:36 AM: + typescript 5.1.6
11:17:36 AM: + vite 4.4.3
11:17:36 AM: + vite-plugin-eslint 1.8.1
11:17:36 AM: + vite-plugin-solid 2.7.0
11:17:36 AM: Done in 6.5s
11:17:36 AM: npm packages installed using pnpm
11:17:37 AM: Install dependencies script success
11:17:37 AM: Starting build script
11:17:37 AM: Detected 1 framework(s)
11:17:37 AM: solid-js at version 1.7.8
11:17:37 AM: Section completed: initializing
11:17:39 AM: ​
11:17:39 AM: Netlify Build
11:17:39 AM: ────────────────────────────────────────────────────────────────
11:17:39 AM: ​
11:17:39 AM: ❯ Version
11:17:39 AM: @netlify/build 29.16.0
11:17:39 AM: ​
11:17:39 AM: ❯ Flags
11:17:39 AM: baseRelDir: true
11:17:39 AM: buildId: 64afc121c77a6800083c925c
11:17:39 AM: deployId: 64afc121c77a6800083c925e
11:17:39 AM: ​
11:17:39 AM: ❯ Current directory
11:17:39 AM: /opt/build/repo
11:17:39 AM: ​
11:17:39 AM: ❯ Config file
11:17:39 AM: No config file was defined: using default values.
11:17:39 AM: ​
11:17:39 AM: ❯ Context
11:17:39 AM: production
11:17:39 AM: ​
11:17:39 AM: Build command from Netlify app
11:17:39 AM: ────────────────────────────────────────────────────────────────
11:17:39 AM: ​
11:17:39 AM: $ npm run build
11:17:39 AM: > vite-template-solid@0.0.0 build
11:17:39 AM: > vite build
11:17:39 AM: vite v4.4.3 building for production…
11:17:40 AM: transforming…
11:17:41 AM: ✓ 26 modules transformed.
11:17:41 AM: rendering chunks…
11:17:41 AM: computing gzip size…
11:17:41 AM: dist/index.html 1.61 kB │ gzip: 1.14 kB
11:17:41 AM: dist/assets/deliveroo-icons-4085fbf8.ttf 9.70 kB
11:17:41 AM: dist/assets/deliveroo-icons-f940bcd8.woff 9.78 kB
11:17:41 AM: dist/assets/deliveroo-icons-7dda7cda.eot 9.90 kB
11:17:41 AM: dist/assets/StratosDeliverooWeb-SemiBold-eb0a0ace.woff2 27.80 kB
11:17:41 AM: dist/assets/IBMPlexSans-65dcfb82.woff2 27.98 kB
11:17:41 AM: dist/assets/IBMPlexSans-Bold-cbe41fc0.woff2 28.57 kB
11:17:41 AM: dist/assets/deliveroo-icons-e4bfe152.svg 32.27 kB │ gzip: 12.49 kB
11:17:41 AM: dist/assets/IBMPlexSans-b322b04f.woff 38.32 kB
11:17:41 AM: dist/assets/IBMPlexSans-Bold-235e8c35.woff 38.75 kB
11:17:41 AM: dist/assets/StratosDeliverooWeb-SemiBold-779fcbc7.woff 40.19 kB
11:17:41 AM: dist/assets/IBMPlexSans-Bold-79ffd409.ttf 86.41 kB
11:17:41 AM: dist/assets/IBMPlexSans-Bold-14ba3a49.eot 86.60 kB
11:17:41 AM: dist/assets/IBMPlexSans-b7809104.ttf 86.71 kB
11:17:41 AM: dist/assets/IBMPlexSans-33d7b2d7.eot 86.90 kB
11:17:41 AM: dist/assets/StratosDeliverooWeb-SemiBold-b0a9ecb1.ttf 120.89 kB
11:17:41 AM: dist/assets/StratosDeliverooWeb-SemiBold-dcbaff57.eot 121.24 kB
11:17:41 AM: dist/assets/StratosDeliverooWeb-SemiBold-4b7113a7.svg 319.75 kB │ gzip: 50.23 kB
11:17:41 AM: dist/assets/IBMPlexSans-5e93d83f.svg 450.91 kB │ gzip: 48.76 kB
11:17:41 AM: dist/assets/IBMPlexSans-Bold-18c73825.svg 453.10 kB │ gzip: 50.32 kB
11:17:41 AM: dist/assets/index-0c052a1b.css 16.59 kB │ gzip: 4.53 kB
11:17:41 AM: dist/assets/index-8f90adf3.js 28.44 kB │ gzip: 10.67 kB
11:17:41 AM: ✓ built in 1.98s
11:17:41 AM: ​
11:17:41 AM: (build.command completed in 2.7s)
11:17:41 AM: ​
11:17:41 AM: Deploy site
11:17:41 AM: ────────────────────────────────────────────────────────────────
11:17:41 AM: ​
11:17:41 AM: Section completed: deploying
11:17:42 AM: ​
11:17:42 AM: Configuration error
11:17:42 AM: ────────────────────────────────────────────────────────────────
11:17:42 AM: ​
11:17:42 AM: Error message
11:17:42 AM: Deploy did not succeed: Deploy directory ‘netlify’ does not exist
11:17:42 AM: ​
11:17:42 AM: Resolved config
11:17:42 AM: build:
11:17:42 AM: command: npm run build
11:17:42 AM: commandOrigin: ui
11:17:42 AM: environment:
11:17:42 AM: - VITE_API_PAGE_URL
11:17:42 AM: publish: /opt/build/repo/netlify
11:17:42 AM: publishOrigin: ui
11:17:42 AM: Caching artifacts
11:17:42 AM: Started saving node modules
11:17:42 AM: Finished saving node modules
11:17:42 AM: Started saving build plugins
11:17:42 AM: Finished saving build plugins
11:17:42 AM: Started saving corepack cache
11:17:42 AM: Finished saving corepack cache
11:17:42 AM: Started saving pip cache
11:17:42 AM: Finished saving pip cache
11:17:42 AM: Started saving emacs cask dependencies
11:17:42 AM: Finished saving emacs cask dependencies
11:17:42 AM: Started saving maven dependencies
11:17:42 AM: Finished saving maven dependencies
11:17:42 AM: Started saving boot dependencies
11:17:42 AM: Finished saving boot dependencies
11:17:42 AM: Started saving rust rustup cache
11:17:42 AM: Finished saving rust rustup cache
11:17:42 AM: Started saving go dependencies
11:17:42 AM: Finished saving go dependencies
11:17:43 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:17:43 AM: Failing build: Failed to build site
11:17:44 AM: Finished processing build request in 20.262s

When I try to build on vercel it succeed, but i want to know why I can’t deploy in netlify, the only error I saw is this : Usage Error: Invalid package manager specification in CLI arguments; expected a semver version, range, or tag

Regards

@ShueiYang Your issue is as it says here:

11:17:42 AM: Error message
11:17:42 AM: Deploy did not succeed: Deploy directory ‘netlify’ does not exist

You have your Publish directory set to netlify and it doesn’t exist.

Adjust your Publish directory to the correct path.

Oh my… I recheck again the log I still can’t see this error message -.- and somehow when I copy paste from the clipboard it show here… now is solved thanks you for taking your time to answer this threat x.x

@ShueiYang You’re not imagining things, I believe there may even be a bit of a bug in the Netlify UI.

I was bitten by it myself quite recently.

If you check, you’ll probably find that it shows the “Build” as having failed

However the message for the actual error is underneath “Deployment” and it shows that as being successful