Hello,
I get an error when trying to build my nextjs application on netlify. This doesn’t happen locally.
I have no idea what to look for.
Here is the full deploy log:
10:25:03 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
10:24:35 PM: Netlify Build
10:24:35 PM: ────────────────────────────────────────────────────────────────
10:24:35 PM:
10:24:35 PM: ❯ Version
10:24:35 PM: @netlify/build 29.12.1
10:24:35 PM:
10:24:35 PM: ❯ Flags
10:24:35 PM: baseRelDir: true
10:24:35 PM: buildId: 64920af2d8f6f61fa5c44d5e
10:24:35 PM: deployId: 64920af2d8f6f61fa5c44d60
10:24:35 PM:
10:24:35 PM: ❯ Current directory
10:24:35 PM: /opt/build/repo
10:24:35 PM:
10:24:35 PM: ❯ Config file
10:24:35 PM: No config file was defined: using default values.
10:24:35 PM:
10:24:35 PM: ❯ Context
10:24:35 PM: production
10:24:35 PM:
10:24:35 PM: ❯ Installing plugins
10:24:35 PM: - @netlify/plugin-nextjs@4.37.4
10:24:43 PM:
10:24:43 PM: ❯ Using Next.js Runtime - v4.37.4
10:24:44 PM:
10:24:44 PM: @netlify/plugin-nextjs (onPreBuild event)
10:24:44 PM: ────────────────────────────────────────────────────────────────
10:24:44 PM:
10:24:44 PM: No Next.js cache to restore.
10:24:44 PM: Netlify configuration property build.environment.NEXT_PRIVATE_TARGET value changed.
10:24:44 PM:
10:24:44 PM: (@netlify/plugin-nextjs onPreBuild completed in 14ms)
10:24:44 PM:
10:24:44 PM: Build command from Netlify app
10:24:44 PM: ────────────────────────────────────────────────────────────────
10:24:44 PM:
10:24:44 PM: $ npm run build
10:24:44 PM: > nextjs-e-commerce-shop@0.1.0 build
10:24:44 PM: > next build
10:24:44 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
10:24:44 PM: info - Skipping linting
10:24:44 PM: info - Checking validity of types...
10:24:47 PM: info - Creating an optimized production build...
10:24:49 PM: Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.
10:24:49 PM: Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
10:24:55 PM: info - Compiled successfully
10:24:55 PM: info - Collecting page data...
10:25:00 PM: info - Generating static pages (0/16)
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: info - Generating static pages (4/16)
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:01 PM: info - Generating static pages (8/16)
10:25:01 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:02 PM: react-i18next:: You will need to pass in an i18next instance by using initReactI18next
10:25:02 PM: Error occurred prerendering page /fr. Read more: https://nextjs.org/docs/messages/prerender-error
10:25:02 PM: You must supply a cloudName when initializing the asset
10:25:02 PM: info - Generating static pages (12/16)
10:25:02 PM: info - Generating static pages (16/16)
10:25:02 PM: > Build error occurred
10:25:02 PM: Error: Export encountered errors on following paths:
10:25:02 PM: /: /fr
10:25:02 PM: at /opt/build/repo/node_modules/next/dist/export/index.js:409:19
10:25:02 PM: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
10:25:02 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
10:25:02 PM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1398:21
10:25:02 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
10:25:02 PM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1258:17
10:25:02 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
10:25:02 PM: at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:66:29)
10:25:02 PM:
10:25:02 PM: build.command failed
10:25:02 PM: ────────────────────────────────────────────────────────────────
10:25:02 PM:
10:25:02 PM: Error message
10:25:02 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
10:25:02 PM:
10:25:02 PM: Error location
10:25:02 PM: In Build command from Netlify app:
10:25:02 PM: npm run build
10:25:02 PM:
10:25:02 PM: Resolved config
10:25:02 PM: build:
10:25:02 PM: command: npm run build
10:25:02 PM: commandOrigin: ui
10:25:02 PM: environment:
10:25:02 PM: - NEXT_PRIVATE_TARGET
10:25:02 PM: publish: /opt/build/repo/.next
10:25:02 PM: publishOrigin: ui
10:25:02 PM: functionsDirectory: /opt/build/repo/functions
10:25:02 PM: plugins:
10:25:02 PM: - inputs: {}
10:25:02 PM: origin: ui
10:25:02 PM: package: '@netlify/plugin-nextjs'
10:25:03 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:25:03 PM: Failing build: Failed to build site
10:25:04 PM: Finished processing build request in 44.544s
10:53:23 PM: [ERROR] Deploy logs are currently unavailable. We are working on resolving the issue.
My website is the following: sunny-travesseiro-986fd7
Could you help me please?
Thank you in advance