Build and Deploy failed

PLEASE assist: build keeps failing on a next js site we are trying to deploy to netlify.

*netlify site name. tourmaline-baklava-68a12d Example: tourmaline-baklava-68a12d

  • Build problems:
    Log:
1:04:40 PM: build-image version: a2d22d22e4555d1ef0a972ed14a0a4b366ad20c4 (focal)
1:04:40 PM: build-image tag: v4.16.3
1:04:40 PM: buildbot version: 3bd65547ad0cc7e555b4d091bb1e3da5ef545973
1:04:41 PM: Fetching cached dependencies
1:04:41 PM: Failed to fetch cache, continuing with build
1:04:41 PM: Starting to prepare the repo for build
1:04:41 PM: No cached dependencies found. Cloning fresh repo
1:04:41 PM: git clone --filter=blob:none https://github.com/RileyManda/cixhub_web
1:04:42 PM: Preparing Git Reference refs/heads/main
1:04:42 PM: Parsing package.json dependencies
1:04:43 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: '.next' versus '' in the Netlify UI
1:04:43 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'next build && next export' versus 'next build' in the Netlify UI
1:04:44 PM: Starting build script
1:04:44 PM: Installing dependencies
1:04:44 PM: Python version set to 2.7
1:04:44 PM: v16.19.0 is already installed.
1:04:44 PM: Now using node v16.19.0 (npm v8.19.3)
1:04:44 PM: Enabling Node.js Corepack
1:04:44 PM: Started restoring cached build plugins
1:04:44 PM: Finished restoring cached build plugins
1:04:44 PM: Attempting Ruby version 2.7.2, read from environment
1:04:45 PM: Using Ruby version 2.7.2
1:04:45 PM: Using PHP version 8.0
1:04:45 PM: Started restoring cached corepack dependencies
1:04:45 PM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
1:04:45 PM: Finished restoring cached corepack dependencies
1:04:45 PM: Started restoring cached yarn cache
1:04:45 PM: Finished restoring cached yarn cache
1:04:45 PM: No yarn workspaces detected
1:04:45 PM: Started restoring cached node modules
1:04:45 PM: Finished restoring cached node modules
1:04:46 PM: Installing npm packages using Yarn version 1.22.19
1:04:46 PM: yarn install v1.22.19
1:04:46 PM: [1/4] Resolving packages...
1:04:46 PM: [2/4] Fetching packages...
1:04:53 PM: warning url-loader@1.1.2: Invalid bin field for "url-loader".
1:05:03 PM: warning np@7.6.3: The engine "git" appears to be invalid.
1:05:03 PM: [3/4] Linking dependencies...
1:05:03 PM: warning " > eslint-config-next@13.1.2" has unmet peer dependency "eslint@^7.23.0 || ^8.0.0".
1:05:03 PM: warning "eslint-config-next > @typescript-eslint/parser@5.48.2" has unmet peer dependency "eslint@^6.0.0 || ^7.0.0 || ^8.0.0".
1:05:03 PM: warning "eslint-config-next > eslint-import-resolver-typescript@3.5.3" has unmet peer dependency "eslint@*".
1:05:03 PM: warning "eslint-config-next > eslint-plugin-import@2.27.5" has unmet peer dependency "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8".
1:05:03 PM: warning "eslint-config-next > eslint-plugin-jsx-a11y@6.7.1" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8".
1:05:03 PM: warning "eslint-config-next > eslint-plugin-react@7.32.1" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7 || ^8".
1:05:03 PM: warning "eslint-config-next > eslint-plugin-react-hooks@4.6.0" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0".
1:05:03 PM: warning "eslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
1:05:03 PM: warning "next-optimized-images > file-loader@3.0.1" has unmet peer dependency "webpack@^4.0.0".
1:05:03 PM: warning "next-optimized-images > raw-loader@2.0.0" has unmet peer dependency "webpack@^4.3.0".
1:05:03 PM: warning "next-optimized-images > url-loader@1.1.2" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
1:05:03 PM: warning " > react-custom-scrollbars@4.2.1" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0".
1:05:03 PM: warning " > react-custom-scrollbars@4.2.1" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.0".
1:05:03 PM: warning " > react-ga@3.3.1" has unmet peer dependency "prop-types@^15.6.0".
1:05:03 PM: warning "react-modal-video > babelify@10.0.0" has unmet peer dependency "@babel/core@^7.0.0".
1:05:03 PM: warning "react-modal-video > eslint-config-airbnb@19.0.4" has unmet peer dependency "eslint-plugin-jsx-a11y@^6.5.1".
1:05:03 PM: warning "react-modal-video > eslint-config-airbnb@19.0.4" has unmet peer dependency "eslint-plugin-react@^7.28.0".
1:05:03 PM: warning "react-modal-video > eslint-config-airbnb@19.0.4" has unmet peer dependency "eslint-plugin-react-hooks@^4.3.0".
1:05:03 PM: warning "react-text-typing > styled-components@5.3.6" has unmet peer dependency "react-is@>= 16.8.0".
1:05:03 PM: warning "theme-ui > @theme-ui/color-modes@0.15.4" has unmet peer dependency "@emotion/react@^11".
1:05:03 PM: warning "theme-ui > @theme-ui/components@0.15.4" has unmet peer dependency "@emotion/react@^11".
1:05:03 PM: warning "theme-ui > @theme-ui/core@0.15.4" has unmet peer dependency "@emotion/react@^11".
1:05:03 PM: warning "theme-ui > @theme-ui/css@0.15.4" has unmet peer dependency "@emotion/react@^11".
1:05:03 PM: warning "theme-ui > @theme-ui/theme-provider@0.15.4" has unmet peer dependency "@emotion/react@^11".
1:05:03 PM: warning " > next-sitemap@3.1.45" has unmet peer dependency "@next/env@*".
1:05:03 PM: warning Workspaces can only be enabled in private projects.
1:05:10 PM: [4/4] Building fresh packages...
1:05:10 PM: Done in 24.34s.
1:05:10 PM: npm packages installed using Yarn
1:05:10 PM: Started restoring cached go cache
1:05:10 PM: Finished restoring cached go cache
1:05:11 PM: Installing Go version 1.19.5 (requested 1.19.x)
1:05:16 PM: unset GOOS;
1:05:16 PM: unset GOARCH;
1:05:16 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.19.5.linux.amd64';
1:05:16 PM: export PATH="/opt/buildhome/.gimme/versions/go1.19.5.linux.amd64/bin:${PATH}";
1:05:16 PM: go version >&2;
1:05:16 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.19.5.linux.amd64.env"
1:05:16 PM: go version go1.19.5 linux/amd64
1:05:16 PM: Detected 1 framework(s)
1:05:16 PM: "next" at version "13.1.2"
1:05:16 PM: Installing missing commands
1:05:16 PM: Verify run directory
1:05:16 PM: Section completed: initializing
1:05:17 PM: ​
1:05:17 PM:   Netlify Build                                                 
1:05:17 PM: ────────────────────────────────────────────────────────────────
1:05:17 PM: ​
1:05:17 PM: ❯ Version
1:05:17 PM:   @netlify/build 29.5.0
1:05:17 PM: ​
1:05:17 PM: ❯ Flags
1:05:17 PM:   baseRelDir: true
1:05:17 PM:   buildId: 63c7d242986fd400851c387a
1:05:17 PM:   deployId: 63c7d242986fd400851c387c
1:05:17 PM: ​
1:05:17 PM: ❯ Current directory
1:05:17 PM:   /opt/build/repo
1:05:17 PM: ​
1:05:17 PM: ❯ Config file
1:05:17 PM:   /opt/build/repo/netlify.toml
1:05:17 PM: ​
1:05:17 PM: ❯ Context
1:05:17 PM:   production
1:05:17 PM: ​
1:05:17 PM: ❯ Installing plugins
1:05:17 PM:    - @netlify/plugin-nextjs@4.30.0
1:05:24 PM: ​
1:05:24 PM: ❯ Using Next.js Runtime - v4.30.0
1:05:25 PM: ​
1:05:25 PM:   1. @netlify/plugin-nextjs (onPreBuild event)                  
1:05:25 PM: ────────────────────────────────────────────────────────────────
1:05:25 PM: ​
1:05:25 PM: No Next.js cache to restore.
1:05:25 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
1:05:25 PM: ​
1:05:25 PM: (@netlify/plugin-nextjs onPreBuild completed in 17ms)
1:05:25 PM: ​
1:05:25 PM:   2. build.command from netlify.toml                            
1:05:25 PM: ────────────────────────────────────────────────────────────────
1:05:25 PM: ​
1:05:25 PM: $ next build && next export
1:05:25 PM: warn  - Invalid next.config.js options detected:
1:05:25 PM:   - The root value has an unexpected property, webpackDevMiddleware, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
1:05:25 PM:   - The root value has an unexpected property, configOrigin, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
1:05:25 PM:   - The root value has an unexpected property, target, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
1:05:25 PM:   - The value at .amp.canonicalBase must be 1 character or more but it was 0 characters.
1:05:25 PM:   - The value at .assetPrefix must be 1 character or more but it was 0 characters.
1:05:25 PM:   - The value at .experimental.outputFileTracingRoot must be 1 character or more but it was 0 characters.
1:05:25 PM:   - The value at .i18n must be an object but it was null.
1:05:25 PM:   - The value at .images.loaderFile must be 1 character or more but it was 0 characters.
1:05:25 PM:   - The value at .reactStrictMode must be a boolean but it was null.
1:05:25 PM: See more info here: https://nextjs.org/docs/messages/invalid-next-config
1:05:25 PM: > Build error occurred
1:05:25 PM: Error: The "target" property is no longer supported in next.config.js.
1:05:25 PM: See more info here https://nextjs.org/docs/messages/deprecated-target-config
1:05:25 PM:     at Object.loadConfig [as default] (/opt/build/repo/node_modules/next/dist/server/config.js:99:19)
1:05:25 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
1:05:25 PM:     at async /opt/build/repo/node_modules/next/dist/build/index.js:70:28
1:05:25 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:79:20)
1:05:25 PM:     at async Object.build [as default] (/opt/build/repo/node_modules/next/dist/build/index.js:66:29)
1:05:25 PM: ​
1:05:25 PM:   "build.command" failed                                        
1:05:25 PM: ────────────────────────────────────────────────────────────────
1:05:25 PM: ​
1:05:25 PM:   Error message
1:05:25 PM:   Command failed with exit code 1: next build && next export (https://ntl.fyi/exit-code-1)
1:05:25 PM: ​
1:05:25 PM:   Error location
1:05:25 PM:   In build.command from netlify.toml:
1:05:25 PM:   next build && next export
1:05:25 PM: ​
1:05:25 PM:   Resolved config
1:05:25 PM:   build:
1:05:25 PM:     command: next build && next export
1:05:25 PM:     commandOrigin: config
1:05:25 PM:     environment:
1:05:25 PM:       - NEXT_PRIVATE_TARGET
1:05:25 PM:     publish: /opt/build/repo/.next
1:05:25 PM:     publishOrigin: config
1:05:25 PM:   plugins:
1:05:25 PM:     - inputs: {}
1:05:25 PM:       origin: ui
1:05:25 PM:       package: '@netlify/plugin-nextjs'
1:05:26 PM: Caching artifacts
1:05:26 PM: Started saving node modules
1:05:26 PM: Finished saving node modules
1:05:26 PM: Started saving build plugins
1:05:26 PM: Finished saving build plugins
1:05:26 PM: Started saving yarn cache
1:05:29 PM: Finished saving yarn cache
1:05:29 PM: Started saving pip cache
1:05:29 PM: Finished saving pip cache
1:05:29 PM: Started saving emacs cask dependencies
1:05:29 PM: Finished saving emacs cask dependencies
1:05:29 PM: Started saving maven dependencies
1:05:29 PM: Finished saving maven dependencies
1:05:29 PM: Started saving boot dependencies
1:05:29 PM: Finished saving boot dependencies
1:05:29 PM: Started saving rust rustup cache
1:05:29 PM: Finished saving rust rustup cache
1:05:29 PM: Started saving go dependencies
1:05:29 PM: Finished saving go dependencies
1:05:29 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:05:30 PM: Failing build: Failed to build site
1:05:30 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:05:30 PM: Finished processing build request in 49.296946101s

Configs
next-config:

const withPlugins = require('next-compose-plugins');
const optimizedImages = require('next-optimized-images');

const nextConfiguration = {
  target: 'serverless', //will output independent pages that don't require a monolithic server. It's only compatible with next start or Serverless deployment platforms (like ZEIT Now) — you cannot use the custom server API.
};

module.exports = withPlugins([optimizedImages], nextConfiguration);

@AskCixHub :wave:t6: Hi are you still experiencing issues with your build and deploy? Your recent deploy summary is showing tit was successful.

Good Day,

Thank you for your email.

In order to achieve a successful deploy,we had to revert to old dependencies that are deprecated.

The error message logged in the logs seems fairly explanatory.