Deploying with next js

Hello,

I am trying to deploy an app built with nextjs but it is not recognising the build command, can you help? Here is the error below:

11:57:58 AM: ​
11:57:58 AM: ────────────────────────────────────────────────────────────────
11:57:58 AM: “build.command” failed
11:57:58 AM: ────────────────────────────────────────────────────────────────
11:57:59 AM: Creating deploy upload records
11:57:58 AM: ​
11:57:58 AM: Error message
11:57:58 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
11:57:58 AM: ​
11:58:00 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:57:58 AM: Error location
11:57:58 AM: In Build command from Netlify app:
11:57:58 AM: npm run build
11:57:58 AM: ​
11:57:58 AM: Resolved config
11:57:58 AM: build:
11:57:58 AM: command: npm run build
11:57:58 AM: commandOrigin: ui
11:57:58 AM: environment:
11:57:58 AM: - NEXT_PRIVATE_TARGET
11:57:58 AM: publish: /opt/build/repo/.next
11:57:58 AM: publishOrigin: ui
11:57:58 AM: plugins:
11:57:58 AM: - inputs: {}
11:57:58 AM: origin: ui
11:57:58 AM: package: ‘@netlify/plugin-nextjs’
11:57:59 AM: Caching artifacts
11:57:59 AM: Started saving node modules
11:57:59 AM: Finished saving node modules
11:57:59 AM: Started saving build plugins
11:57:59 AM: Finished saving build plugins
11:57:59 AM: Started saving pip cache
11:57:59 AM: Finished saving pip cache
11:57:59 AM: Started saving emacs cask dependencies
11:57:59 AM: Finished saving emacs cask dependencies
11:57:59 AM: Started saving maven dependencies
11:57:59 AM: Finished saving maven dependencies
11:57:59 AM: Started saving boot dependencies
11:57:59 AM: Finished saving boot dependencies
11:57:59 AM: Started saving rust rustup cache
11:57:59 AM: Finished saving rust rustup cache
11:57:59 AM: Started saving go dependencies
11:57:59 AM: Finished saving go dependencies
11:57:59 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:58:00 AM: Failing build: Failed to build site
11:58:00 AM: Finished processing build request in 33.541788685s

Hi @cwebster85, if possible can you share a repository of your site for me to help with the debugging?

Thanks.

Hello I’m so sorry for the late reply. I don’t know how I missed it!

This is the repo: https://github.com/cwebster85/ecommerce

no worries, what site are you referring to? you have about 19

Sorry I didn’t specify, here is the site: [gleeful-cajeta-637bed]

(Netlify App)

Hi @cwebster85, looks like your repository is private hence a 404 error when I visit the link you shared.

oh god such a simple issue lol so sorry! thank you!!!

1 Like

No worries, thanks so much for sharing the fix .