Error building Next.js app where build fails

PLEASE help us help you by writing a good post!

comforting-madeleine-6cead2.netlify.app
Build Problem.

Error building Next.js app where build fails. The build used to fail because of next plugin failure.

1:26:56 PM: “build.command” failed
1:26:56 PM: ────────────────────────────────────────────────────────────────
1:26:56 PM: ​
1:26:56 PM: Error message
1:26:56 PM: Command failed with exit code 1: CI= npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
1:26:56 PM: ​
1:26:56 PM: Error location
1:26:56 PM: In Build command from Netlify app:
1:26:56 PM: CI= npm run build
1:26:56 PM: ​
1:26:56 PM: Resolved config
1:26:56 PM: build:
1:26:56 PM: base: /opt/build/repo/canofmystery
1:26:56 PM: command: CI= npm run build
1:26:56 PM: commandOrigin: ui
1:26:56 PM: environment:
1:26:56 PM: - NETLIFY_NEXT_PLUGIN_SKIP
1:26:56 PM: - NEXT_DISABLE_NETLIFY_EDGE
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_API_KEY
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_APP_ID
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_PROJECT_ID
1:26:56 PM: - NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
1:26:56 PM: - NODE_VERSION
1:26:56 PM: - NPM_FLAGS
1:26:56 PM: - NEXT_PRIVATE_TARGET
1:26:56 PM: publish: /opt/build/repo/canofmystery/.next
1:26:56 PM: publishOrigin: ui
1:26:56 PM: plugins:
1:26:56 PM: - inputs: {}
1:26:56 PM: origin: ui
1:26:56 PM: package: “@netlify/plugin-nextjs”
1:26:57 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
1:26:57 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:26:57 PM: Failing build: Failed to build site
1:26:57 PM: Finished processing build request in 1m45.061s

Also, some imports are not being recognized even through they are recognized in the dev environment.

@aawalter You should provide your full build log.

The section that you’ve provided is the end result and some of your configuration, it doesn’t show the cause.