Netlify Site Name: stalwart-gumdrop-3db015.netlify.app
Custom Domain: ai-decoder.com
I’m encountering a build error, but there aren’t any specific errors reported in the logs. I’ve addressed all previous warnings, yet the build still doesn’t complete successfully.
Here are the logs from the most recent build attempt. From what I can see, everything seems to build as expected, but then it suddenly exits with the message: “Build failed due to a user error: Build script returned non-zero exit code: 2.”
3:51:03 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:50:38 PM: Netlify Build
3:50:38 PM: ────────────────────────────────────────────────────────────────
3:50:38 PM:
3:50:38 PM: ❯ Version
3:50:38 PM: @netlify/build 29.20.11
3:50:38 PM:
3:50:38 PM: ❯ Flags
3:50:38 PM: baseRelDir: true
3:50:38 PM: buildId: 64f1ec0fdebc2100083ed10a
3:50:38 PM: deployId: 64f1ec0fdebc2100083ed10c
3:50:38 PM:
3:50:38 PM: ❯ Current directory
3:50:38 PM: /opt/build/repo/frontend
3:50:38 PM:
3:50:38 PM: ❯ Config file
3:50:38 PM: No config file was defined: using default values.
3:50:38 PM:
3:50:38 PM: ❯ Context
3:50:38 PM: production
3:50:38 PM:
3:50:38 PM: Build command from Netlify app
3:50:38 PM: ────────────────────────────────────────────────────────────────
3:50:38 PM:
3:50:38 PM: $ npm run build
3:50:38 PM: > datamatrixvue@0.1.0 build
3:50:38 PM: > vue-cli-service build
3:50:39 PM: All browser targets in the browserslist configuration have supported ES module.
3:50:39 PM: Therefore we don't build two separate bundles for differential loading.
3:50:39 PM: - Building for production...
3:50:52 PM: [BABEL] Note: The code generator has deoptimised the styling of /opt/build/repo/frontend/node_modules/@firebase/firestore/dist/index.esm2017.js as it exceeds the max of 500KB.
3:51:00 PM: DONE Compiled successfully in 21104ms1:51:00 PM
3:51:00 PM: File Size Gzipped
3:51:00 PM: dist/js/chunk-vendors.7d9e1c12.js 586.02 KiB 144.88 KiB
3:51:00 PM: dist/js/95.8fc47c7d.js 30.54 KiB 12.02 KiB
3:51:00 PM: dist/js/492.8f2e0f0f.js 15.02 KiB 4.08 KiB
3:51:00 PM: dist/js/496.912916d6.js 12.10 KiB 4.40 KiB
3:51:00 PM: dist/js/754.64dbeb3a.js 11.85 KiB 3.48 KiB
3:51:00 PM: dist/js/app.285f6593.js 8.97 KiB 3.89 KiB
3:51:00 PM: dist/js/903.156cf95e.js 8.80 KiB 2.80 KiB
3:51:00 PM: dist/js/313.1a2521bd.js 7.90 KiB 2.53 KiB
3:51:00 PM: dist/js/342.716b3957.js 5.85 KiB 1.98 KiB
3:51:00 PM: dist/js/798.c041f89b.js 5.78 KiB 2.29 KiB
3:51:00 PM: dist/js/912.0ffae7d4.js 5.39 KiB 1.90 KiB
3:51:00 PM: dist/js/886.a7d8f717.js 5.27 KiB 1.81 KiB
3:51:00 PM: dist/js/902.98953b57.js 3.89 KiB 1.69 KiB
3:51:00 PM: dist/js/697.b743e3f1.js 2.89 KiB 1.28 KiB
3:51:00 PM: dist/js/127.715059aa.js 2.36 KiB 1.23 KiB
3:51:00 PM: dist/css/app.ba97b724.css 20.23 KiB 4.50 KiB
3:51:00 PM: dist/css/798.6da5e74d.css 0.54 KiB 0.30 KiB
3:51:00 PM: dist/css/903.6da5e74d.css 0.54 KiB 0.30 KiB
3:51:00 PM: dist/css/496.44b16959.css 0.30 KiB 0.23 KiB
3:51:00 PM: dist/css/912.32023f0e.css 0.15 KiB 0.13 KiB
3:51:00 PM: Images and other types of assets omitted.
3:51:00 PM: Build at: 2023-09-01T13:51:00.916Z - Hash: 48a1c41c9bf62a5c - Time: 21104ms
3:51:00 PM: DONE Build complete. The dist directory is ready to be deployed.
3:51:00 PM: INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
3:51:01 PM:
3:51:01 PM: (build.command completed in 22.5s)
3:51:01 PM:
3:51:03 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:51:03 PM: Failing build: Failed to build site
3:51:04 PM: Finished processing build request in 55.639s
Can someone assist? I tried downgrading Node to version 16, but that made no difference. I also applied lazy loading to components that aren’t rendered on mount, such as modals.
EDIT:
I apologize for the oversight; this issue arose due to a switch from React to Vue, which made me forget to change the deployment folder from “build” to “dist.”
The solution was to alter the Netlify setting from “build” to “dist.” This wasn’t highlighted in the Build logs, which showed an “error code 2”. However, in the Deployment logs (even though they had a green checkmark), there was clear logging about what had transpired.
I’d suggest revisiting the UI since this was incorrectly labeled as a build error, when in fact, it was a deployment error.