Local build works but Netlify build is failing

Hello team,
When I execute npm run build on my local machine it works fine but when I deploy in Netlify I keep getting the below error. Please find the necessary aspects below

12:17:36 PM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
12:17:36 PM: buildbot version: 22552e71c3c7b6a5ebfd780eb1c9b2f42fe63aa7
12:17:37 PM: Building without cache
12:17:37 PM: Starting to prepare the repo for build
12:17:37 PM: No cached dependencies found. Cloning fresh repo
12:17:37 PM: git clone --filter=blob:none https://github.com/CCG-Digital-Operations/contenthub
12:17:37 PM: Preparing Git Reference refs/heads/production
12:17:40 PM: Starting to install dependencies
12:17:40 PM: Python version set to 3.8
12:17:40 PM: Attempting Ruby version 2.7.2, read from environment
12:17:41 PM: Using Ruby version 2.7.2
12:17:42 PM: Started restoring cached go cache
12:17:42 PM: Finished restoring cached go cache
12:17:42 PM: go version go1.19.13 linux/amd64
12:17:42 PM: Using PHP version 8.0
12:17:44 PM: v18.20.4 is already installed.
12:17:44 PM: Now using node v18.20.4 (npm v10.7.0)
12:17:44 PM: Enabling Node.js Corepack
12:17:44 PM: Started restoring cached build plugins
12:17:44 PM: Finished restoring cached build plugins
12:17:44 PM: Started restoring cached corepack dependencies
12:17:44 PM: Finished restoring cached corepack dependencies
12:17:44 PM: No npm workspaces detected
12:17:44 PM: Started restoring cached node modules
12:17:44 PM: Finished restoring cached node modules
12:17:45 PM: Installing npm packages using npm version 10.7.0
12:17:51 PM: npm warn deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm warn deprecated workbox-cacheable-response@6.6.0: workbox-background-sync@6.6.0
12:17:52 PM: npm warn deprecated workbox-google-analytics@6.6.0: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
12:17:52 PM: npm warn deprecated string-similarity@1.2.2: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
12:17:52 PM: npm warn deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
12:17:52 PM: npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:17:52 PM: npm warn deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
12:17:52 PM: npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
12:17:53 PM: npm warn deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
12:17:54 PM: npm warn deprecated har-validator@5.1.5: this library is no longer supported
12:17:55 PM: npm warn deprecated domexception@4.0.0: Use your platform's native DOMException instead
npm warn deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
12:18:00 PM: npm warn deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm warn deprecated @babel/plugin-proposal-private-property-in-object@7.21.11: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.
12:18:00 PM: npm warn deprecated @babel/plugin-proposal-private-methods@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
12:18:00 PM: npm warn deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
12:18:00 PM: npm warn deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
12:18:00 PM: npm warn deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
12:18:00 PM: npm warn deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
12:18:01 PM: npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
12:18:01 PM: npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
12:18:02 PM: npm warn deprecated domexception@2.0.1: Use your platform's native DOMException instead
npm warn deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
12:18:49 PM: > @caadigitalops/ccg-contenthub@0.1.0 prepare
12:18:49 PM: > husky
12:18:49 PM: added 3157 packages, and audited 3158 packages in 1m
12:18:49 PM: 439 packages are looking for funding
12:18:49 PM:   run `npm fund` for details
12:18:49 PM: 49 vulnerabilities (11 low, 22 moderate, 16 high)
12:18:49 PM: To address issues that do not require attention, run:
12:18:49 PM:   npm audit fix
12:18:49 PM: To address all issues possible (including breaking changes), run:
12:18:49 PM:   npm audit fix --force
12:18:49 PM: Some issues need review, and may require choosing
12:18:49 PM: a different dependency.
12:18:49 PM: Run `npm audit` for details.
12:18:49 PM: npm packages installed
12:18:50 PM: Successfully installed dependencies
12:18:50 PM: Starting build script
12:18:51 PM: Detected 2 framework(s)
12:18:51 PM: "next" at version "13.5.6"
12:18:51 PM: "create-react-app" at version "5.0.1"
12:18:51 PM: Section completed: initializing
12:18:53 PM: ​
12:18:53 PM: Netlify Build                                                 
12:18:53 PM: ────────────────────────────────────────────────────────────────
12:18:53 PM: ​
12:18:53 PM: ❯ Version
12:18:53 PM:   @netlify/build 29.51.3
12:18:53 PM: ​
12:18:53 PM: ❯ Flags
12:18:53 PM:   baseRelDir: true
12:18:53 PM:   buildId: 66a9121459756a4ae46c8c6d
12:18:53 PM:   deployId: 66a9121459756a4ae46c8c6f
12:18:53 PM: ​
12:18:53 PM: ❯ Current directory
12:18:53 PM:   /opt/build/repo
12:18:53 PM: ​
12:18:53 PM: ❯ Config file
12:18:53 PM:   /opt/build/repo/netlify.toml
12:18:53 PM: ​
12:18:53 PM: ❯ Context
12:18:53 PM:   production
12:18:53 PM: ​
12:18:53 PM: ❯ Using Next.js Runtime - v5.0.0-rc.3
12:18:53 PM: ​
12:18:53 PM: ❯ Outdated plugins
12:18:53 PM:    - @netlify/plugin-nextjs@5.0.0-rc.3: latest version is 5.6.0
12:18:53 PM:      To upgrade this plugin, please update its version in "package.json"
12:18:54 PM: No Next.js cache to restore
12:18:54 PM: ​
12:18:54 PM: build.command from netlify.toml                               
12:18:54 PM: ────────────────────────────────────────────────────────────────
12:18:54 PM: ​
12:18:54 PM: $ npm run build
12:18:54 PM: > @caadigitalops/ccg-contenthub@0.1.0 build
12:18:54 PM: > next build
12:18:55 PM: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
12:18:55 PM:    Linting and checking validity of types ...
12:19:10 PM: ./src/common/common.d.ts
12:19:10 PM: 11:13  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 12:16  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 23:8  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 24:13  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 26:17  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 76:16  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/CategoryAvatars/CategoryAvatars.tsx
12:19:10 PM: 8:56  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/CustomImage/CustomImage.tsx
12:19:10 PM: 10:16  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Filters/ArticleToolbar.tsx
12:19:10 PM: 116:6  Warning: React Hook useEffect has missing dependencies: 'focusCallBack', 'router', 'routerQuery?.search', and 'routerQuery.slug'. Either include them or remove the dependency array. If 'focusCallBack' changes too often, find the parent component that defines it and wrap that definition in useCallback.  react-hooks/exhaustive-deps
12:19:10 PM: ./src/components/Filters/FeatureDropdown.d.tsx
12:19:10 PM: 54:49  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 97:50  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 107:45  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 115:45  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Filters/Filter.helper.ts
12:19:10 PM: 134:80  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 138:63  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Filters/MagazineToolbar.tsx
12:19:10 PM: 56:6  Warning: React Hook useEffect has a missing dependency: 'router.query'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
12:19:10 PM: 82:6  Warning: React Hook useEffect has missing dependencies: 'focusCallBack' and 'router'. Either include them or remove the dependency array. If 'focusCallBack' changes too often, find the parent component that defines it and wrap that definition in useCallback.  react-hooks/exhaustive-deps
12:19:10 PM: ./src/components/FullWidthBlock/FullWidthBlock.d.ts
12:19:10 PM: 15:17  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Hooks/useCategoryData.tsx
12:19:10 PM: 19:42  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Hooks/useFetcher.tsx
12:19:10 PM: 11:12  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 17:11  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 23:44  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 40:32  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Hooks/useShouldScroll.tsx
12:19:10 PM: 3:32  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/Hooks/useSiteConfigData.tsx
12:19:10 PM: 39:6  Warning: React Hook useEffect has a missing dependency: 'fetchSiteConfigData'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
12:19:10 PM: ./src/components/Icon/Icon.tsx
12:19:10 PM: 8:24  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 12:10  Warning: Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element  @next/next/no-img-element
12:19:10 PM: ./src/components/LOB/Avatar/Avatar.d.tsx
12:19:10 PM: 13:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/Avatar/Supplement/Avatar.stories.tsx
12:19:10 PM: 3:10  Warning: 'Description' is defined but never used.  @typescript-eslint/no-unused-vars
12:19:10 PM: ./src/components/LOB/Button/Button.d.tsx
12:19:10 PM: 67:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/Card/Card.d.tsx
12:19:10 PM: 70:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/Chip/Chip.tsx
12:19:10 PM: 10:24  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/FreeText/Supplement/FreeText.stories.tsx
12:19:10 PM: 1:8  Warning: 'React' is defined but never used.  @typescript-eslint/no-unused-vars
12:19:10 PM: ./src/components/LOB/Hero/Hero.d.tsx
12:19:10 PM: 7:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 27:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 112:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 122:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 127:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/MediaBlock/Supplement/MediaBlock.stories.tsx
12:19:10 PM: 1:8  Warning: 'React' is defined but never used.  @typescript-eslint/no-unused-vars
12:19:10 PM: ./src/components/LOB/NavBar/Components/Autocomplete.tsx
12:19:10 PM: 292:6  Warning: React Hook useMemo has a missing dependency: 'facetFilters'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
12:19:10 PM: 327:6  Warning: React Hook useEffect has missing dependencies: 'autocompleteProps', 'instantSearchUiState.query', 'onReset', and 'onSubmit'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps
12:19:10 PM: ./src/components/LOB/NavBar/Components/SearchResult.tsx
12:19:10 PM: 70:6  Warning: React Hook useEffect has a missing dependency: 'searchButtonRef'. Either include it or remove the dependency array.  react-hooks/exhaustive-deps
12:19:10 PM: ./src/components/LOB/NavBar/Components/Slideout/MobileNav/MobileMenu.d.tsx
12:19:10 PM: 8:15  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/NavBar/Components/Slideout/MobileSearchNav/MobileSearchNav.d.tsx
12:19:10 PM: 4:15  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/Pagination/Pagination.tsx
12:19:10 PM: 1:28  Warning: 'useRef' is defined but never used.  @typescript-eslint/no-unused-vars
12:19:10 PM: ./src/components/LOB/RenderNode/RenderNode.d.tsx
12:19:10 PM: 19:24  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/SectionWrapper/Components/WithScroll.tsx
12:19:10 PM: 57:33  Warning: React Hook useCallback received a function whose dependencies are unknown. Pass an inline function instead.  react-hooks/exhaustive-deps
12:19:10 PM: ./src/components/LOB/SectionWrapper/SectionWrapper.d.tsx
12:19:10 PM: 26:71  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 40:17  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/Slideout/Slideout.d.tsx
12:19:10 PM: 9:29  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 15:34  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 16:35  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/LOB/SocialPanel/supplement/SocialPanel.test.tsx
12:19:10 PM: 8:10  Warning: 'act' is defined but never used.  @typescript-eslint/no-unused-vars
12:19:10 PM: ./src/components/LOB/TextBlock/TextBlock.d.tsx
12:19:10 PM: 32:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/OutletView/OutletView.tsx
12:19:10 PM: 9:17  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/components/PageComponents/supplement/RootContainer.test.tsx
12:19:10 PM: 36:21  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/lib/api.ts
12:19:10 PM: 47:26  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 125:43  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 155:25  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/lib/experiences.ts
12:19:10 PM: 5:20  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/utils/analytics.ts
12:19:10 PM: 121:19  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 122:16  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 125:14  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/utils/contentfulApi.ts
12:19:10 PM: 3:12  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 6:47  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/utils/helper.ts
12:19:10 PM: 64:84  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/utils/supplement/analytics.test.tsx
12:19:10 PM: 18:16  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 21:23  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 22:23  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/utils/supplement/contentfulApi.test.tsx
12:19:10 PM: 34:42  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: 45:43  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: ./src/utils/utility.ts
12:19:10 PM: 16:27  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
12:19:10 PM: info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
12:19:10 PM:    Creating an optimized production build ...
12:19:18 PM:  ✓ Compiled successfully
12:19:18 PM:    Collecting page data ...
12:19:21 PM:    Generating static pages (0/874) ...
12:19:26 PM: Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
12:19:26 PM:     at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:74:493)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
12:19:26 PM:     at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
12:19:26 PM:     at $c (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
12:19:26 PM:     at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
12:19:26 PM:     at $c (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
12:19:26 PM:     at bd (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
12:19:26 PM: Error occurred prerendering page "/en/on/safety/outsmarting-vehicle-thieves-tips-to-protect-your-car". Read more: https://nextjs.org/docs/messages/prerender-error
12:19:26 PM: Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
12:19:26 PM:     at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:74:493)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
12:19:26 PM:     at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:481)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
12:19:26 PM:     at $c (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
12:19:26 PM:     at Zc (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
12:19:26 PM:     at $c (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
12:19:26 PM:     at bd (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
12:19:26 PM:     at Z (/opt/build/repo/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
12:19:30 PM:    Generating static pages (218/874)
12:19:34 PM:    Generating static pages (436/874)
12:19:38 PM:    Generating static pages (655/874)
12:19:41 PM:  ✓ Generating static pages (874/874)
12:19:41 PM: > Export encountered errors on following paths:
12:19:41 PM: 	/[[...slug]]: /en/on/safety/outsmarting-vehicle-thieves-tips-to-protect-your-car
12:19:41 PM: ​
12:19:41 PM: "build.command" failed                                        
12:19:41 PM: ────────────────────────────────────────────────────────────────
12:19:41 PM: ​
12:19:41 PM:   Error message
12:19:41 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
12:19:41 PM: ​
12:19:41 PM:   Error location
12:19:41 PM:   In build.command from netlify.toml:
12:19:41 PM:   npm run build
12:19:41 PM: ​
12:19:41 PM:   Resolved config
12:19:41 PM:   build:
12:19:41 PM:     command: npm run build
12:19:41 PM:     commandOrigin: config
12:19:41 PM:     environment:
12:19:41 PM:       - NEXT_PUBLIC_ALGOLIA_APPLICATION_ID
12:19:41 PM:       - NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_API
12:19:41 PM:       - NEXT_PUBLIC_APP_DOMAIN
12:19:41 PM:       - NEXT_PUBLIC_APP_ENV
12:19:41 PM:       - NEXT_PUBLIC_CONTENTFUL_DELIVERY_TOKEN
12:19:41 PM:       - NEXT_PUBLIC_CONTENTFUL_ENVIRONMENT
12:19:41 PM:       - NEXT_PUBLIC_CONTENTFUL_MANAGEMENT_TOKEN
12:19:41 PM:       - NEXT_PUBLIC_CONTENTFUL_PREVIEW_TOKEN
12:19:41 PM:       - NEXT_PUBLIC_CONTENTFUL_SPACE_ID
12:19:41 PM:       - NEXT_PUBLIC_GOOGLE_ANALYTICS_ID
12:19:41 PM:       - NEXT_PUBLIC_GOOGLE_API_KEY
12:19:41 PM:       - NEXT_PUBLIC_INSTA_API_KEY_MB
12:19:41 PM:       - NEXT_PUBLIC_INSTA_API_KEY_SCO
12:19:41 PM:       - NEXT_PUBLIC_NINETAILED_CLIENT_ID
12:19:41 PM:       - NEXT_PUBLIC_NINETAILED_ENVIRONMENT
12:19:41 PM:       - NEXT_PUBLIC_NINETAILED_MANAGEMENT_CLIENT_ID
12:19:41 PM:       - NEXT_PUBLIC_NINETAILED_MANAGEMENT_SECRET
12:19:41 PM:       - NEXT_PUBLIC_PIWIK_ID
12:19:41 PM:       - NPM_FLAGS
12:19:41 PM:     publish: /opt/build/repo/.next
12:19:41 PM:     publishOrigin: config
12:19:41 PM:   plugins:
12:19:41 PM:     - inputs: {}
12:19:41 PM:       origin: config
12:19:41 PM:       package: '@netlify/plugin-nextjs'
12:19:42 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:19:42 PM: Failing build: Failed to build site
12:19:42 PM: Finished processing build request in 2m5.536s
12:19:42 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)

Kindly take a look and let us know the possible solution. Hope to receive assistance soon from the team.

hey Asif, thanks for reaching out!

Since it looks like this is working locally when the runtime isn’t used, for the next steps, I’d love to:

  • Confirm that the build settings match between the two environments
  • Confirm you’re using the same versions locally as you are on Netlify
  • It looks like you’ve currently pinned the Next runtime version:
9:25:05 AM: ❯ Outdated plugins
9:25:05 AM:    - @netlify/plugin-nextjs@5.0.0-rc.3: latest version is 5.5.1
9:25:05 AM:      To upgrade this plugin, please update its version in "package.json"

I’d also recommend unpinning that to be able to use the latest version of the runtime. Let us know if after looking through these you’re still having issues!