hi, i want to deploy my next.js site on netlify but get this error ‘internal server error 500’ in index page.
*site : https://chic-lamington-54e584.netlify.app/
12:26:34 PM: build-image version: d7b3813f01c06610bc1723ff1b22446513ee7941 (focal)
12:26:34 PM: build-image tag: v4.14.3
12:26:34 PM: buildbot version: 4dcf475b8df8e5368becf6538fc83d1d4914f8fc
12:26:34 PM: Fetching cached dependencies
12:26:34 PM: Starting to download cache of 161.4MB
12:26:36 PM: Finished downloading cache in 1.122552425s
12:26:36 PM: Starting to extract cache
12:26:37 PM: Finished extracting cache in 1.614340871s
12:26:37 PM: Finished fetching cache in 2.801204941s
12:26:37 PM: Starting to prepare the repo for build
12:26:37 PM: Preparing Git Reference refs/heads/main
12:26:38 PM: Parsing package.json dependencies
12:26:39 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'out_publish' versus '.next' in the Netlify UI
12:26:39 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'out_functions' versus '' in the Netlify UI
12:26:39 PM: Starting build script
12:26:39 PM: Installing dependencies
12:26:39 PM: Python version set to 2.7
12:26:39 PM: Started restoring cached node version
12:26:40 PM: Finished restoring cached node version
12:26:40 PM: v16.18.1 is already installed.
12:26:40 PM: Now using node v16.18.1 (npm v8.19.2)
12:26:40 PM: Enabling node corepack
12:26:40 PM: Started restoring cached build plugins
12:26:40 PM: Finished restoring cached build plugins
12:26:40 PM: Attempting ruby version 2.7.2, read from environment
12:26:41 PM: Using ruby version 2.7.2
12:26:41 PM: Using PHP version 8.0
12:26:42 PM: No npm workspaces detected
12:26:42 PM: Started restoring cached node modules
12:26:42 PM: Finished restoring cached node modules
12:26:42 PM: Installing NPM modules using NPM version 8.19.2
12:26:44 PM: added 75 packages, and audited 463 packages in 2s
12:26:44 PM: 107 packages are looking for funding
12:26:44 PM: run `npm fund` for details
12:26:44 PM: found 0 vulnerabilities
12:26:44 PM: NPM modules installed
12:26:44 PM: Creating package sha
12:26:44 PM: Started restoring cached go cache
12:26:44 PM: Finished restoring cached go cache
12:26:44 PM: Installing Go version 1.17 (requested 1.17)
12:26:48 PM: unset GOOS;
12:26:48 PM: unset GOARCH;
12:26:48 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
12:26:48 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
12:26:48 PM: go version >&2;
12:26:48 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
12:26:48 PM: go version go1.17 linux/amd64
12:26:48 PM: Detected 1 framework(s)
12:26:48 PM: "next" at version "12.2.5"
12:26:48 PM: Installing missing commands
12:26:48 PM: Verify run directory
12:26:50 PM:
12:26:50 PM: ────────────────────────────────────────────────────────────────
12:26:50 PM: Netlify Build
12:26:50 PM: ────────────────────────────────────────────────────────────────
12:26:50 PM:
12:26:50 PM: ❯ Version
12:26:50 PM: @netlify/build 28.1.7
12:26:50 PM:
12:26:50 PM: ❯ Flags
12:26:50 PM: baseRelDir: true
12:26:50 PM: buildId: 63662540d6dcc20008765657
12:26:50 PM: deployId: 63662540d6dcc20008765659
12:26:50 PM:
12:26:50 PM: ❯ Current directory
12:26:50 PM: /opt/build/repo
12:26:50 PM:
12:26:50 PM: ❯ Config file
12:26:50 PM: /opt/build/repo/netlify.toml
12:26:50 PM:
12:26:50 PM: ❯ Context
12:26:50 PM: production
12:26:50 PM:
12:26:50 PM: ❯ Using Next.js Runtime - v4.21.2
12:26:50 PM:
12:26:50 PM: ❯ Outdated plugins
12:26:50 PM: - @netlify/plugin-nextjs@4.21.2: latest version is 4.28.4
12:26:50 PM: Migration guide: https://ntl.fyi/next-plugin-migration
12:26:50 PM: To upgrade this plugin, please update its version in "package.json"
12:26:51 PM:
12:26:51 PM: ────────────────────────────────────────────────────────────────
12:26:51 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
12:26:51 PM: ────────────────────────────────────────────────────────────────
12:26:51 PM:
12:26:51 PM: No Next.js cache to restore.
12:26:51 PM: Netlify configuration property "build.environment.NEXT_PRIVATE_TARGET" value changed.
12:26:51 PM:
12:26:51 PM: (@netlify/plugin-nextjs onPreBuild completed in 18ms)
12:26:51 PM:
12:26:51 PM: ────────────────────────────────────────────────────────────────
12:26:51 PM: 2. build.command from netlify.toml
12:26:51 PM: ────────────────────────────────────────────────────────────────
12:26:51 PM:
12:26:51 PM: $ npm run build
12:26:51 PM: > hulu-v2-nextjs@0.1.0 build
12:26:51 PM: > next build
12:26:52 PM: warn - Invalid next.config.js options detected:
12:26:52 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, future, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, staticPageGenerationTimeout, swcMinify, trailingSlash, typescript, useFileSystemPublicRoutes, webpack).
12:26:52 PM: See more info here: https://nextjs.org/docs/messages/invalid-next-config
12:26:52 PM: warn - The `target` config is deprecated and will be removed in a future version.
12:26:52 PM: See more info here https://nextjs.org/docs/messages/deprecated-target-config
12:26:52 PM: info - SWC minify release candidate enabled. https://nextjs.link/swcmin
12:26:52 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
12:26:52 PM: info - Linting and checking validity of types...
12:26:54 PM: info - Creating an optimized production build...
12:26:58 PM: info - Compiled successfully
12:26:58 PM: info - Collecting page data...
12:27:01 PM: info - Generating static pages (0/2)
12:27:01 PM: info - Generating static pages (2/2)
12:27:01 PM: info - Finalizing page optimization...
12:27:01 PM: Route (pages) Size First Load JS
12:27:01 PM: ┌ λ / 12.7 kB 90.5 kB
12:27:01 PM: ├ /_app 0 B 77.9 kB
12:27:01 PM: ├ ○ /404 186 B 78.1 kB
12:27:01 PM: └ λ /api/hello 0 B 77.9 kB
12:27:01 PM: + First Load JS shared by all 80.5 kB
12:27:01 PM: ├ chunks/framework-db825bd0b4ae01ef.js 45.7 kB
12:27:01 PM: ├ chunks/main-3123a443c688934f.js 30.9 kB
12:27:01 PM: ├ chunks/pages/_app-0e6b46beaaa55ac1.js 498 B
12:27:01 PM: ├ chunks/webpack-7ee66019f7f6d30f.js 755 B
12:27:01 PM: └ css/cdd2203d46214d7c.css 2.65 kB
12:27:01 PM: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
12:27:01 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
12:27:01 PM: > hulu-v2-nextjs@0.1.0 postbuild
12:27:01 PM: > next-on-netlify
12:27:01 PM: node:internal/modules/cjs/loader:988
12:27:01 PM: throw err;
12:27:01 PM: ^
12:27:02 PM: Creating deploy upload records
12:27:01 PM: Error: Cannot find module 'find-cache-dir'
12:27:01 PM: Require stack:
12:27:01 PM: - /opt/build/repo/node_modules/next-on-netlify/lib/steps/prepareFolders.js
12:27:01 PM: - /opt/build/repo/node_modules/next-on-netlify/index.js
12:27:02 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:27:01 PM: - /opt/build/repo/node_modules/next-on-netlify/next-on-netlify.js
12:27:01 PM: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
12:27:01 PM: at Function.Module._load (node:internal/modules/cjs/loader:833:27)
12:27:01 PM: at Module.require (node:internal/modules/cjs/loader:1057:19)
12:27:01 PM: at require (node:internal/modules/cjs/helpers:103:18)
12:27:01 PM: at Object.<anonymous> (/opt/build/repo/node_modules/next-on-netlify/lib/steps/prepareFolders.js:3:22)
12:27:01 PM: at Module._compile (node:internal/modules/cjs/loader:1155:14)
12:27:01 PM: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
12:27:01 PM: at Module.load (node:internal/modules/cjs/loader:1033:32)
12:27:01 PM: at Function.Module._load (node:internal/modules/cjs/loader:868:12)
12:27:01 PM: at Module.require (node:internal/modules/cjs/loader:1057:19) {
12:27:01 PM: code: 'MODULE_NOT_FOUND',
12:27:01 PM: requireStack: [
12:27:01 PM: '/opt/build/repo/node_modules/next-on-netlify/lib/steps/prepareFolders.js',
12:27:01 PM: '/opt/build/repo/node_modules/next-on-netlify/index.js',
12:27:01 PM: '/opt/build/repo/node_modules/next-on-netlify/next-on-netlify.js'
12:27:01 PM: ]
12:27:01 PM: }
12:27:01 PM:
12:27:01 PM: ────────────────────────────────────────────────────────────────
12:27:01 PM: "build.command" failed
12:27:01 PM: ────────────────────────────────────────────────────────────────
12:27:01 PM:
12:27:01 PM: Error message
12:27:01 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
12:27:01 PM:
12:27:01 PM: Error location
12:27:01 PM: In build.command from netlify.toml:
12:27:01 PM: npm run build
12:27:01 PM:
12:27:01 PM: Resolved config
12:27:01 PM: build:
12:27:01 PM: command: npm run build
12:27:01 PM: commandOrigin: config
12:27:01 PM: environment:
12:27:01 PM: - NEXT_PRIVATE_TARGET
12:27:01 PM: publish: /opt/build/repo/out_publish
12:27:01 PM: publishOrigin: config
12:27:01 PM: functions:
12:27:01 PM: '*':
12:27:01 PM: included_files:
12:27:02 PM: - public/locales/* functionsDirectory: /opt/build/repo/out_functions plugins: - inputs: {} origin: ui package: '@netlify/plugin-nextjs'Caching artifacts
12:27:02 PM: Started saving node modules
12:27:02 PM: Finished saving node modules
12:27:02 PM: Started saving build plugins
12:27:02 PM: Finished saving build plugins
12:27:02 PM: Started saving pip cache
12:27:02 PM: Finished saving pip cache
12:27:02 PM: Started saving emacs cask dependencies
12:27:02 PM: Finished saving emacs cask dependencies
12:27:02 PM: Started saving maven dependencies
12:27:02 PM: Finished saving maven dependencies
12:27:02 PM: Started saving boot dependencies
12:27:02 PM: Finished saving boot dependencies
12:27:02 PM: Started saving rust rustup cache
12:27:02 PM: Finished saving rust rustup cache
12:27:02 PM: Started saving go dependencies
12:27:02 PM: Finished saving go dependencies
12:27:02 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:27:02 PM: Failing build: Failed to build site
12:27:02 PM: Finished processing build request in 28.03432268s