PLEASE help us help you by writing a good post!
- We need to know your netlify site name. Example:
gifted-antelope-58b104.netlify.app
- 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
- Did you try Ask Netlify, our generative AI chatbot, before posting? It pulls info from Support Guides and recent solved forums posts.
The better the post - the faster the answer.
5:49:17 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)
5:49:17 PM: Deploy site
5:49:17 PM: ────────────────────────────────────────────────────────────────
5:49:17 PM:
5:49:17 PM: Section completed: deploying
5:49:17 PM:
5:49:17 PM: Configuration error
5:49:17 PM: ────────────────────────────────────────────────────────────────
5:49:17 PM:
5:49:17 PM: Error message
5:49:17 PM: Deploy did not succeed: Deploy directory ‘build’ does not exist
5:49:17 PM:
5:49:17 PM: Resolved config
5:49:17 PM: build:
5:49:17 PM: command: CI= npm run build
5:49:17 PM: commandOrigin: ui
5:49:17 PM: environment:
5:49:17 PM: - CI
5:49:17 PM: publish: /opt/build/repo/build
5:49:17 PM: publishOrigin: config
5:49:17 PM: functions:
5:49:17 PM: functions:
5:49:17 PM: external_node_modules:
5:49:17 PM: - express
5:49:17 PM: - mongoose
5:49:17 PM: - serverless-http
5:49:17 PM: - cors
5:49:17 PM: node_bundler: esbuild
5:49:17 PM: functionsDirectory: /opt/build/repo/netlify/functions
5:49:17 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:49:17 PM: Failing build: Failed to build site