Error at deployment of a nextjs application

my previous commit worked as expect. but i made some changes in the app, but when i tried to deploy, i got an error.
if i run npm run build and npm run export in localhost, the exportment works as expect

4:23:55 PM: build-image version: 69285e8b40f1b6adf78be62b2fda2250efb9694b (focal)
4:23:55 PM: buildbot version: 69285e8b40f1b6adf78be62b2fda2250efb9694b
4:23:55 PM: Fetching cached dependencies
4:23:55 PM: Starting to download cache of 271.2MB
4:23:57 PM: Finished downloading cache in 2.162s
4:23:57 PM: Starting to extract cache
4:24:01 PM: Finished extracting cache in 4.012s
4:24:02 PM: Finished fetching cache in 6.22s
4:24:02 PM: Starting to prepare the repo for build
4:24:02 PM: Preparing Git Reference refs/heads/main
4:24:02 PM: Parsing package.json dependencies
4:24:04 PM: Starting build script
4:24:04 PM: Installing dependencies
4:24:04 PM: Python version set to 2.7
4:24:04 PM: Started restoring cached Node.js version
4:24:04 PM: Finished restoring cached Node.js version
4:24:05 PM: v16.19.1 is already installed.
4:24:05 PM: Now using node v16.19.1 (npm v8.19.3)
4:24:05 PM: Enabling Node.js Corepack
4:24:05 PM: Started restoring cached build plugins
4:24:05 PM: Finished restoring cached build plugins
4:24:05 PM: Attempting Ruby version 2.7.2, read from environment
4:24:06 PM: Using Ruby version 2.7.2
4:24:06 PM: Using PHP version 8.0
4:24:06 PM: Started restoring cached corepack dependencies
4:24:06 PM: Finished restoring cached corepack dependencies
4:24:06 PM: No npm workspaces detected
4:24:06 PM: Started restoring cached node modules
4:24:06 PM: Finished restoring cached node modules
4:24:06 PM: Installing npm packages using npm version 8.19.3
4:24:12 PM: npm WARN ERESOLVE overriding peer dependency
4:24:12 PM: npm WARN While resolving: react-inspector@5.1.1
4:24:12 PM: npm WARN Found: react@18.2.0
4:24:12 PM: npm WARN node_modules/react
4:24:12 PM: npm WARN react@β€œlatest” from the root project
4:24:12 PM: npm WARN 59 more (@design-systems/utils, …)
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Could not resolve dependency:
4:24:12 PM: npm WARN peer react@β€œ^16.8.4 || ^17.0.0” from react-inspector@5.1.1
4:24:12 PM: npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
4:24:12 PM: npm WARN react-inspector@β€œ^5.1.0” from @storybook/addon-actions@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/addon-actions
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Conflicting peer dependency: react@17.0.2
4:24:12 PM: npm WARN node_modules/react
4:24:12 PM: npm WARN peer react@β€œ^16.8.4 || ^17.0.0” from react-inspector@5.1.1
4:24:12 PM: npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
4:24:12 PM: npm WARN react-inspector@β€œ^5.1.0” from @storybook/addon-actions@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/addon-actions
4:24:12 PM: npm WARN ERESOLVE overriding peer dependency
4:24:12 PM: npm WARN While resolving: @mdx-js/react@1.6.22
4:24:12 PM: npm WARN Found: react@18.2.0
4:24:12 PM: npm WARN node_modules/react
4:24:12 PM: npm WARN react@β€œlatest” from the root project
4:24:12 PM: npm WARN 59 more (@design-systems/utils, …)
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Could not resolve dependency:
4:24:12 PM: npm WARN peer react@β€œ^16.13.1 || ^17.0.0” from @mdx-js/react@1.6.22
4:24:12 PM: npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
4:24:12 PM: npm WARN @mdx-js/react@β€œ^1.6.22” from @storybook/addon-docs@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/addon-docs
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Conflicting peer dependency: react@17.0.2
4:24:12 PM: npm WARN node_modules/react
4:24:12 PM: npm WARN peer react@β€œ^16.13.1 || ^17.0.0” from @mdx-js/react@1.6.22
4:24:12 PM: npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
4:24:12 PM: npm WARN @mdx-js/react@β€œ^1.6.22” from @storybook/addon-docs@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/addon-docs
4:24:12 PM: npm WARN ERESOLVE overriding peer dependency
4:24:12 PM: npm WARN While resolving: react-element-to-jsx-string@14.3.4
4:24:12 PM: npm WARN Found: react@18.2.0
4:24:12 PM: npm WARN node_modules/react
4:24:12 PM: npm WARN react@β€œlatest” from the root project
4:24:12 PM: npm WARN 59 more (@design-systems/utils, …)
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Could not resolve dependency:
4:24:12 PM: npm WARN peer react@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
4:24:12 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
4:24:12 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/react
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Conflicting peer dependency: react@17.0.2
4:24:12 PM: npm WARN node_modules/react
4:24:12 PM: npm WARN peer react@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
4:24:12 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
4:24:12 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/react
4:24:12 PM: npm WARN ERESOLVE overriding peer dependency
4:24:12 PM: npm WARN While resolving: react-element-to-jsx-string@14.3.4
4:24:12 PM: npm WARN Found: react-dom@18.2.0
4:24:12 PM: npm WARN node_modules/react-dom
4:24:12 PM: npm WARN react-dom@β€œlatest” from the root project
4:24:12 PM: npm WARN 41 more (@design-systems/utils, @mui/base, @mui/material, …)
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Could not resolve dependency:
4:24:12 PM: npm WARN peer react-dom@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
4:24:12 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
4:24:12 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/react
4:24:12 PM: npm WARN
4:24:12 PM: npm WARN Conflicting peer dependency: react-dom@17.0.2
4:24:12 PM: npm WARN node_modules/react-dom
4:24:12 PM: npm WARN peer react-dom@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
4:24:12 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
4:24:12 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
4:24:12 PM: npm WARN node_modules/@storybook/react
4:24:16 PM: > mauro-chrisostimo@0.1.0 postinstall
4:24:16 PM: > npm run prepare
4:24:16 PM: > mauro-chrisostimo@0.1.0 prepare
4:24:16 PM: > husky install
4:24:16 PM: sh: 1: husky: not found
4:24:16 PM: npm ERR! code 127
4:24:16 PM: npm ERR! path /opt/build/repo
4:24:16 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
4:24:16 PM: npm ERR! command failed
4:24:16 PM: npm ERR! command sh -c – npm run prepare
4:24:16 PM: npm ERR! A complete log of this run can be found in:
4:24:16 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-03-06T19_24_06_929Z-debug-0.log
4:24:16 PM: Error during npm install
4:24:16 PM: Build was terminated: Build script returned non-zero exit code: 1
4:24:16 PM: Failing build: Failed to build site
4:24:16 PM: Finished processing build request in 21.16s

Can you share your build settings?

Yes. i have set an env
NETLIFY_NEXT_PLUGIN_SKIP true.
and my build command is a script called npm run deploy-static, which is the command β€œnpm run build && npm run export”
and i’m serving the out folder.
both commands works in localhost

Hi @ZAPHODh, looks like the quoted error message above is reason for the build error.

Kindly try the suggestions in the link below since the problem is similar to yours.

Thanks.

yes, i founded this error and solved it by my own, but now i get another error on log…
(there is a lot of warnig of non-used variables because i comment the graphql part of my code to see if the error keep)
6:53:21 PM: build-image version: 69285e8b40f1b6adf78be62b2fda2250efb9694b (focal)
6:53:21 PM: buildbot version: 69285e8b40f1b6adf78be62b2fda2250efb9694b
6:53:22 PM: Fetching cached dependencies
6:53:22 PM: Starting to download cache of 271.2MB
6:53:24 PM: Finished downloading cache in 2.47s
6:53:24 PM: Starting to extract cache
6:53:27 PM: Finished extracting cache in 3.449s
6:53:28 PM: Finished fetching cache in 5.973s
6:53:28 PM: Starting to prepare the repo for build
6:53:28 PM: Preparing Git Reference refs/heads/main
6:53:28 PM: Parsing package.json dependencies
6:53:30 PM: Starting build script
6:53:30 PM: Installing dependencies
6:53:30 PM: Python version set to 2.7
6:53:30 PM: Started restoring cached Node.js version
6:53:31 PM: Finished restoring cached Node.js version
6:53:31 PM: v16.19.1 is already installed.
6:53:31 PM: Now using node v16.19.1 (npm v8.19.3)
6:53:31 PM: Enabling Node.js Corepack
6:53:31 PM: Started restoring cached build plugins
6:53:31 PM: Finished restoring cached build plugins
6:53:32 PM: Attempting Ruby version 2.7.2, read from environment
6:53:32 PM: Using Ruby version 2.7.2
6:53:32 PM: Using PHP version 8.0
6:53:32 PM: Started restoring cached corepack dependencies
6:53:32 PM: Finished restoring cached corepack dependencies
6:53:33 PM: No npm workspaces detected
6:53:33 PM: Started restoring cached node modules
6:53:33 PM: Finished restoring cached node modules
6:53:33 PM: Installing npm packages using npm version 8.19.3
6:53:40 PM: npm WARN ERESOLVE overriding peer dependency
6:53:40 PM: npm WARN While resolving: react-inspector@5.1.1
6:53:40 PM: npm WARN Found: react@18.2.0
6:53:40 PM: npm WARN node_modules/react
6:53:40 PM: npm WARN react@β€œlatest” from the root project
6:53:40 PM: npm WARN 59 more (@design-systems/utils, …)
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Could not resolve dependency:
6:53:40 PM: npm WARN peer react@β€œ^16.8.4 || ^17.0.0” from react-inspector@5.1.1
6:53:40 PM: npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
6:53:40 PM: npm WARN react-inspector@β€œ^5.1.0” from @storybook/addon-actions@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/addon-actions
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Conflicting peer dependency: react@17.0.2
6:53:40 PM: npm WARN node_modules/react
6:53:40 PM: npm WARN peer react@β€œ^16.8.4 || ^17.0.0” from react-inspector@5.1.1
6:53:40 PM: npm WARN node_modules/@storybook/addon-actions/node_modules/react-inspector
6:53:40 PM: npm WARN react-inspector@β€œ^5.1.0” from @storybook/addon-actions@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/addon-actions
6:53:40 PM: npm WARN ERESOLVE overriding peer dependency
6:53:40 PM: npm WARN While resolving: @mdx-js/react@1.6.22
6:53:40 PM: npm WARN Found: react@18.2.0
6:53:40 PM: npm WARN node_modules/react
6:53:40 PM: npm WARN react@β€œlatest” from the root project
6:53:40 PM: npm WARN 59 more (@design-systems/utils, …)
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Could not resolve dependency:
6:53:40 PM: npm WARN peer react@β€œ^16.13.1 || ^17.0.0” from @mdx-js/react@1.6.22
6:53:40 PM: npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
6:53:40 PM: npm WARN @mdx-js/react@β€œ^1.6.22” from @storybook/addon-docs@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/addon-docs
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Conflicting peer dependency: react@17.0.2
6:53:40 PM: npm WARN node_modules/react
6:53:40 PM: npm WARN peer react@β€œ^16.13.1 || ^17.0.0” from @mdx-js/react@1.6.22
6:53:40 PM: npm WARN node_modules/@storybook/addon-docs/node_modules/@mdx-js/react
6:53:40 PM: npm WARN @mdx-js/react@β€œ^1.6.22” from @storybook/addon-docs@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/addon-docs
6:53:40 PM: npm WARN ERESOLVE overriding peer dependency
6:53:40 PM: npm WARN While resolving: react-element-to-jsx-string@14.3.4
6:53:40 PM: npm WARN Found: react@18.2.0
6:53:40 PM: npm WARN node_modules/react
6:53:40 PM: npm WARN react@β€œlatest” from the root project
6:53:40 PM: npm WARN 59 more (@design-systems/utils, …)
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Could not resolve dependency:
6:53:40 PM: npm WARN peer react@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
6:53:40 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
6:53:40 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/react
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Conflicting peer dependency: react@17.0.2
6:53:40 PM: npm WARN node_modules/react
6:53:40 PM: npm WARN peer react@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
6:53:40 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
6:53:40 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/react
6:53:40 PM: npm WARN ERESOLVE overriding peer dependency
6:53:40 PM: npm WARN While resolving: react-element-to-jsx-string@14.3.4
6:53:40 PM: npm WARN Found: react-dom@18.2.0
6:53:40 PM: npm WARN node_modules/react-dom
6:53:40 PM: npm WARN react-dom@β€œlatest” from the root project
6:53:40 PM: npm WARN 41 more (@design-systems/utils, @mui/base, @mui/material, …)
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Could not resolve dependency:
6:53:40 PM: npm WARN peer react-dom@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
6:53:40 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
6:53:40 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/react
6:53:40 PM: npm WARN
6:53:40 PM: npm WARN Conflicting peer dependency: react-dom@17.0.2
6:53:40 PM: npm WARN node_modules/react-dom
6:53:40 PM: npm WARN peer react-dom@β€œ^0.14.8 || ^15.0.1 || ^16.0.0 || ^17.0.1” from react-element-to-jsx-string@14.3.4
6:53:40 PM: npm WARN node_modules/@storybook/react/node_modules/react-element-to-jsx-string
6:53:40 PM: npm WARN react-element-to-jsx-string@β€œ^14.3.4” from @storybook/react@6.5.15
6:53:40 PM: npm WARN node_modules/@storybook/react
6:53:45 PM: added 21 packages, removed 1 package, changed 3 packages, and audited 2415 packages in 12s
6:53:45 PM: 386 packages are looking for funding
6:53:45 PM: run npm fund for details
6:53:45 PM: 21 high severity vulnerabilities
6:53:45 PM: To address issues that do not require attention, run:
6:53:45 PM: npm audit fix
6:53:45 PM: To address all issues (including breaking changes), run:
6:53:45 PM: npm audit fix --force
6:53:45 PM: Run npm audit for details.
6:53:45 PM: npm packages installed
6:53:45 PM: Started restoring cached go cache
6:53:45 PM: Finished restoring cached go cache
6:53:45 PM: go version go1.19.6 linux/amd64
6:53:45 PM: Detected 2 framework(s)
6:53:45 PM: β€œnext” at version β€œ13.1.2”
6:53:45 PM: β€œvite” at version β€œ4.1.4”
6:53:45 PM: Section completed: initializing
6:53:47 PM: ​
6:53:47 PM: Netlify Build
6:53:47 PM: ────────────────────────────────────────────────────────────────
6:53:47 PM: ​
6:53:47 PM: ❯ Version
6:53:47 PM: @netlify/build 29.6.3
6:53:47 PM: ​
6:53:47 PM: ❯ Flags
6:53:47 PM: baseRelDir: true
6:53:47 PM: buildId: 640660d0fce56200079c6e54
6:53:47 PM: deployId: 640660d0fce56200079c6e56
6:53:47 PM: ​
6:53:47 PM: ❯ Current directory
6:53:47 PM: /opt/build/repo
6:53:47 PM: ​
6:53:47 PM: ❯ Config file
6:53:47 PM: No config file was defined: using default values.
6:53:47 PM: ​
6:53:47 PM: ❯ Context
6:53:47 PM: production
6:53:47 PM: ​
6:53:47 PM: ❯ Using Next.js Runtime - v4.31.0
6:53:48 PM: ​
6:53:48 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
6:53:48 PM: ────────────────────────────────────────────────────────────────
6:53:48 PM: ​
6:53:49 PM: Next.js cache restored.
6:53:49 PM: Not running Next Runtime
6:53:49 PM: ​
6:53:49 PM: (@netlify/plugin-nextjs onPreBuild completed in 155ms)
6:53:49 PM: ​
6:53:49 PM: 2. Build command from Netlify app
6:53:49 PM: ────────────────────────────────────────────────────────────────
6:53:49 PM: ​
6:53:49 PM: $ npm run deploy-static
6:53:49 PM: > mauro-chrisostimo@0.1.0 deploy-static
6:53:49 PM: > npm run build && npm run export
6:53:49 PM: > mauro-chrisostimo@0.1.0 build
6:53:49 PM: > next build
6:53:50 PM: info - Linting and checking validity of types…
6:53:53 PM: ./src/components/Schedule/index.tsx
6:53:53 PM: 18:8 Warning: β€˜request’ is defined but never used. @typescript-eslint/no-unused-vars
6:53:53 PM: 19:10 Warning: β€˜NEW_SCHEDULER’ is defined but never used. @typescript-eslint/no-unused-vars
6:53:53 PM: 26:24 Warning: β€˜setErrorMessage’ is assigned a value but never used. @typescript-eslint/no-unused-vars
6:53:53 PM: 32:10 Warning: β€˜dateSelected’ is assigned a value but never used. @typescript-eslint/no-unused-vars
6:53:53 PM: info - Need to disable some ESLint rules? Learn more here: Basic Features: ESLint | Next.js
6:53:55 PM: info - Creating an optimized production build…
6:53:56 PM: warn - Found lockfile missing swc dependencies, run next locally to automatically patch
6:54:06 PM: info - Compiled successfully
6:54:06 PM: info - Collecting page data…
6:54:14 PM: info - Generating static pages (0/3)
6:54:15 PM: Error occurred prerendering page β€œ/”. Read more: prerender-error | Next.js
6:54:15 PM: TypeError: Cannot read properties of undefined (reading β€˜document’)
6:54:15 PM: at parseRequestExtendedArgs (/opt/build/repo/node_modules/graphql-request/dist/parseArgs.js:42:25)
6:54:15 PM: at /opt/build/repo/node_modules/graphql-request/dist/index.js:446:67
6:54:15 PM: at step (/opt/build/repo/node_modules/graphql-request/dist/index.js:67:23)
6:54:15 PM: at Object.next (/opt/build/repo/node_modules/graphql-request/dist/index.js:48:53)
6:54:15 PM: at /opt/build/repo/node_modules/graphql-request/dist/index.js:42:71
6:54:15 PM: at new Promise ()
6:54:15 PM: at __awaiter (/opt/build/repo/node_modules/graphql-request/dist/index.js:38:12)
6:54:15 PM: at request (/opt/build/repo/node_modules/graphql-request/dist/index.js:443:12)
6:54:15 PM: at getStaticProps (/opt/build/repo/.next/server/pages/index.js:2283:87)
6:54:15 PM: at renderToHTML (/opt/build/repo/node_modules/next/dist/server/render.js:385:26)
6:54:15 PM: info - Generating static pages (3/3)
6:54:15 PM: > Build error occurred
6:54:15 PM: Error: Export encountered errors on following paths:
6:54:15 PM: /
6:54:15 PM: at /opt/build/repo/node_modules/next/dist/export/index.js:409:19
6:54:15 PM: at runMicrotasks ()
6:54:15 PM: at processTicksAndRejections (node:internal/process/task_queues:96:5)
6:54:15 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
6:54:15 PM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1398:21
6:54:15 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
6:54:15 PM: at async /opt/build/repo/node_modules/next/dist/build/index.js:1258:17
6:54:15 PM: at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
6:54:15 PM: at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:66:29)
6:54:16 PM: ​
6:54:16 PM: β€œbuild.command” failed
6:54:16 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)
6:54:16 PM: ────────────────────────────────────────────────────────────────
6:54:16 PM: ​
6:54:16 PM: Error message
6:54:16 PM: Command failed with exit code 1: npm run deploy-static (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
6:54:16 PM: ​
6:54:16 PM: Error location
6:54:16 PM: In Build command from Netlify app:
6:54:16 PM: npm run deploy-static
6:54:16 PM: ​
6:54:16 PM: Resolved config
6:54:16 PM: build:
6:54:16 PM: command: npm run deploy-static
6:54:16 PM: commandOrigin: ui
6:54:16 PM: environment:
6:54:16 PM: - NETLIFY_NEXT_PLUGIN_SKIP
6:54:16 PM: publish: /opt/build/repo/out
6:54:16 PM: publishOrigin: ui
6:54:16 PM: plugins:
6:54:16 PM: - inputs: {}
6:54:16 PM: origin: ui
6:54:16 PM: package: β€˜@netlify/plugin-nextjs’
6:54:16 PM: Caching artifacts
6:54:16 PM: Started saving node modules
6:54:16 PM: Finished saving node modules
6:54:16 PM: Started saving build plugins
6:54:16 PM: Finished saving build plugins
6:54:16 PM: Started saving corepack cache
6:54:16 PM: Finished saving corepack cache
6:54:16 PM: Started saving pip cache
6:54:16 PM: Finished saving pip cache
6:54:16 PM: Started saving emacs cask dependencies
6:54:16 PM: Finished saving emacs cask dependencies
6:54:16 PM: Started saving maven dependencies
6:54:16 PM: Finished saving maven dependencies
6:54:16 PM: Started saving boot dependencies
6:54:16 PM: Finished saving boot dependencies
6:54:16 PM: Started saving rust rustup cache
6:54:16 PM: Finished saving rust rustup cache
6:54:16 PM: Started saving go dependencies
6:54:16 PM: Finished saving go dependencies
6:54:16 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:54:16 PM: Failing build: Failed to build site
6:54:16 PM: Finished processing build request in 54.893s

i dont know why the build command are failed because in localhost the build run

@ZAPHODh I see lots of peer dependency warnings, have you tried resolving those?

1 Like

yes. i tryed npm-check-updates, dedune and outdated itens, its everything ok

hi @ZAPHODh

I’ve noticed this on your build log:

6:54:15 PM: TypeError: Cannot read properties of undefined (reading β€˜document’)

while the build was trying to generate the static pages.

Where are you trying to read from document?