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]Site - SITE - SITE https://carrybags.netlify.app
12:17:41 AM: Plugin “@netlify/plugin-nextjs” failed
12:17:41 AM: ────────────────────────────────────────────────────────────────
12:17:41 AM:
12:17:41 AM: Error message
12:17:41 AM: Error: The directory “/opt/build/repo/.next” does not contain a Next.js production build. Perhaps the build command was not run, or you specified the wrong publish directory.
12:17:41 AM: In most cases it should be set to “.next”, unless you have chosen a custom “distDir” in your Next config.
12:17:41 AM: If you are using “next export” then you should set the environment variable NETLIFY_NEXT_PLUGIN_SKIP to “true”.
12:17:41 AM:
12:17:41 AM: Plugin details
12:17:41 AM: Package: @netlify/plugin-nextjs
12:17:41 AM: Version: 4.30.4
12:17:41 AM: Repository: git+https://github.com/netlify/next-runtime.git
12:17:41 AM: npm link: @netlify/plugin-nextjs - npm
12:17:41 AM: Report issues: Issues · netlify/next-runtime · GitHub
12:17:41 AM:
12:17:41 AM: Error location
12:17:41 AM: In “onBuild” event in “@netlify/plugin-nextjs” from Netlify app
12:17:41 AM:
12:17:41 AM: Resolved config
12:17:41 AM: build:
12:17:41 AM: command: yarn build
12:17:41 AM: commandOrigin: ui
12:17:41 AM: environment:
12:17:41 AM: - NEXT_PRIVATE_TARGET
12:17:41 AM: publish: /opt/build/repo/.next
12:17:41 AM: publishOrigin: ui
12:17:41 AM: plugins:
12:17:41 AM: - inputs: {}
12:17:41 AM: origin: ui
12:17:41 AM: package: ‘@netlify/plugin-nextjs’
12:17:42 AM: Caching artifacts
12:17:42 AM: Started saving node modules
12:17:42 AM: Finished saving node modules
12:17:42 AM: Started saving build plugins
12:17:42 AM: Finished saving build plugins
12:17:42 AM: Started saving corepack cache
12:17:42 AM: Finished saving corepack cache
12:17:42 AM: Started saving yarn cache
12:17:53 AM: Finished saving yarn cache
12:17:53 AM: Started saving pip cache
12:17:53 AM: Finished saving pip cache
12:17:53 AM: Started saving emacs cask dependencies
12:17:53 AM: Finished saving emacs cask dependencies
12:17:53 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)
12:17:53 AM: Started saving maven dependencies
12:17:53 AM: Finished saving maven dependencies
12:17:53 AM: Started saving boot dependencies
12:17:53 AM: Finished saving boot dependencies
12:17:53 AM: Started saving rust rustup cache
12:17:53 AM: Finished saving rust rustup cache
12:17:53 AM: Started saving go dependencies
12:17:53 AM: Finished saving go dependencies
12:17:53 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:17:53 AM: Failing build: Failed to build site
12:17:54 AM: Finished processing build request in 2m23.464s
© 2023 Netlify
The better the post - the faster the answer.