Hello all,
Before asking for help I looked through the forums and tried multiple solutions to no avail. My issue is my next App is not deploying correctly. The deployment runs successfully but when I go to the URL I get βpage not foundβ
My Next.config.js file looks like this:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
distDir: "build",
target: "serverless",
};
module.exports = nextConfig;
My netlify.toml file:
[build]
command = "npm run build && npm run export"
publish = "/build"
base ="/"
Package.json:
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"export": "next export"
},
"dependencies": {
"next": "12.2.2",
"react": "18.2.0",
"react-dom": "18.2.0"
},
The production build is this:
7:27:57 PM: Build ready to start
7:28:06 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
7:28:06 PM: build-image tag: v4.10.1
7:28:06 PM: buildbot version: 4cffa5dc84445a450e8be6f710e2498d87994fae
7:28:06 PM: Fetching cached dependencies
7:28:07 PM: Starting to download cache of 593.0MB
7:28:11 PM: Finished downloading cache in 4.015042702s
7:28:11 PM: Starting to extract cache
7:28:13 PM: Finished extracting cache in 2.790223838s
7:28:13 PM: Finished fetching cache in 6.909305826s
7:28:13 PM: Starting to prepare the repo for build
7:28:14 PM: Preparing Git Reference refs/heads/main
7:28:15 PM: Parsing package.json dependencies
7:28:16 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/build' in the Netlify UI
7:28:16 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus '' in the Netlify UI
7:28:16 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm run build && npm run export' versus 'npm run build' in the Netlify UI
7:28:16 PM: Starting build script
7:28:16 PM: Installing dependencies
7:28:16 PM: Python version set to 2.7
7:28:16 PM: Started restoring cached node version
7:28:17 PM: Finished restoring cached node version
7:28:18 PM: v16.17.0 is already installed.
7:28:18 PM: Now using node v16.17.0 (npm v8.15.0)
7:28:18 PM: Started restoring cached build plugins
7:28:18 PM: Finished restoring cached build plugins
7:28:18 PM: Attempting ruby version 2.7.2, read from environment
7:28:19 PM: Using ruby version 2.7.2
7:28:19 PM: Using PHP version 8.0
7:28:19 PM: Started restoring cached yarn cache
7:28:20 PM: Finished restoring cached yarn cache
7:28:20 PM: No yarn workspaces detected
7:28:20 PM: Started restoring cached node modules
7:28:20 PM: Finished restoring cached node modules
7:28:20 PM: Installing NPM modules using Yarn version 1.22.10
7:28:21 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:28:21 PM: npm WARN config location in the cache, and they are managed by
7:28:21 PM: npm WARN config [`cacache`](http://npm.im/cacache).
7:28:21 PM: yarn install v1.22.10
7:28:21 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
7:28:21 PM: [1/4] Resolving packages...
7:28:22 PM: [2/4] Fetching packages...
7:28:22 PM: info @next/swc-darwin-arm64@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-darwin-arm64@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-darwin-arm64@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info @next/swc-linux-arm64-gnu@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info "@next/swc-linux-arm64-gnu@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-linux-arm-gnueabihf@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info "@next/swc-linux-arm-gnueabihf@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-linux-arm64-musl@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info "@next/swc-linux-arm64-musl@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-android-arm64@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-android-arm64@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-android-arm64@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info @next/swc-darwin-x64@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-darwin-x64@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-win32-arm64-msvc@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-win32-arm64-msvc@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-win32-arm64-msvc@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info @next/swc-win32-x64-msvc@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-win32-x64-msvc@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-win32-ia32-msvc@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-win32-ia32-msvc@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-win32-ia32-msvc@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: info @next/swc-freebsd-x64@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-freebsd-x64@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-android-arm-eabi@12.2.2: The platform "linux" is incompatible with this module.
7:28:22 PM: info "@next/swc-android-arm-eabi@12.2.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:28:22 PM: info @next/swc-android-arm-eabi@12.2.2: The CPU architecture "x64" is incompatible with this module.
7:28:22 PM: [3/4] Linking dependencies...
7:28:22 PM: [4/4] Building fresh packages...
7:28:22 PM: success Saved lockfile.
7:28:22 PM: Done in 1.55s.
7:28:22 PM: NPM modules installed using Yarn
7:28:23 PM: Started restoring cached go cache
7:28:23 PM: Finished restoring cached go cache
7:28:23 PM: Installing Go version 1.16.5 (requested 1.16.5)
7:28:27 PM: unset GOOS;
7:28:27 PM: unset GOARCH;
7:28:27 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64';
7:28:27 PM: export PATH="/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64/bin:${PATH}";
7:28:27 PM: go version >&2;
7:28:27 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.16.5.linux.amd64.env"
7:28:27 PM: go version go1.16.5 linux/amd64
7:28:27 PM: Installing missing commands
7:28:27 PM: Verify run directory
7:28:28 PM: β
7:28:28 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:28 PM: Netlify Build
7:28:28 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:28 PM: β
7:28:28 PM: β― Version
7:28:28 PM: @netlify/build 27.11.5
7:28:28 PM: β
7:28:28 PM: β― Flags
7:28:28 PM: baseRelDir: true
7:28:28 PM: buildId: 62fd797d2855950008dccbc6
7:28:28 PM: deployId: 62fd797d2855950008dccbc8
7:28:28 PM: β
7:28:28 PM: β― Current directory
7:28:28 PM: /opt/build/repo
7:28:28 PM: β
7:28:28 PM: β― Config file
7:28:28 PM: /opt/build/repo/netlify.toml
7:28:28 PM: β
7:28:28 PM: β― Context
7:28:28 PM: production
7:28:28 PM: β
7:28:28 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:28 PM: 1. build.command from netlify.toml
7:28:28 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:28 PM: β
7:28:28 PM: $ npm run build && npm run export
7:28:28 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:28:28 PM: npm WARN config location in the cache, and they are managed by
7:28:28 PM: npm WARN config [`cacache`](http://npm.im/cacache).
7:28:28 PM: > japan-cc@0.1.0 build
7:28:28 PM: > next build
7:28:28 PM: warn - The `target` config is deprecated and will be removed in a future version.
7:28:28 PM: See more info here https://nextjs.org/docs/messages/deprecated-target-config
7:28:28 PM: info - SWC minify release candidate enabled. https://nextjs.link/swcmin
7:28:28 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
7:28:28 PM: info - Linting and checking validity of types...
7:28:30 PM: ./pages/course.tsx
7:28:30 PM: 43:9 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 43:9 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./pages/courses.tsx
7:28:30 PM: 32:9 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 32:9 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: 38:13 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 38:13 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: 53:15 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 53:15 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./components/Body/index.tsx
7:28:30 PM: 56:7 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 56:7 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./components/Courses/index.tsx
7:28:30 PM: 20:7 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 20:7 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./components/Footer/index.tsx
7:28:30 PM: 32:9 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 32:9 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./components/Posts/index.tsx
7:28:30 PM: 22:7 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 22:7 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./components/Reviews/index.tsx
7:28:30 PM: 16:15 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 16:15 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: 23:17 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 23:17 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: ./components/Staff/index.tsx
7:28:30 PM: 46:11 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 46:11 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: 76:17 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element
7:28:30 PM: 76:17 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
7:28:30 PM: info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
7:28:31 PM: info - Creating an optimized production build...
7:28:35 PM: info - Compiled successfully
7:28:35 PM: info - Collecting page data...
7:28:37 PM: info - Generating static pages (0/6)
7:28:38 PM: info - Generating static pages (1/6)
7:28:38 PM: info - Generating static pages (2/6)
7:28:38 PM: info - Generating static pages (4/6)
7:28:38 PM: info - Generating static pages (6/6)
7:28:38 PM: info - Finalizing page optimization...
7:28:38 PM: Page Size First Load JS
7:28:38 PM: β β / (312 ms) 3.65 kB 81.9 kB
7:28:38 PM: β β css/4c389932d785ffa0.css 1.52 kB
7:28:38 PM: β /_app 0 B 78.3 kB
7:28:38 PM: β β /404 186 B 78.5 kB
7:28:38 PM: β β /boarding (312 ms) 3.21 kB 81.5 kB
7:28:38 PM: β β css/853d53fd108c77df.css 732 B
7:28:38 PM: β β /course (315 ms) 3.67 kB 81.9 kB
7:28:38 PM: β β css/76bc6e24d4388017.css 781 B
7:28:38 PM: β β /courses 3.03 kB 81.3 kB
7:28:38 PM: β css/8263c09a877f357b.css 980 B
7:28:38 PM: + First Load JS shared by all 78.3 kB
7:28:38 PM: β chunks/framework-ae4f43955bfa5ddc.js 45.7 kB
7:28:38 PM: β chunks/main-3cf1b4d0a841b0b4.js 31.1 kB
7:28:38 PM: β chunks/pages/_app-0b9fa9d238e133c7.js 662 B
7:28:38 PM: β chunks/webpack-34c76af51fb9f015.js 760 B
7:28:38 PM: β css/c46d95ee57f08382.css 148 B
7:28:38 PM: β (Static) automatically rendered as static HTML (uses no initial props)
7:28:38 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
7:28:38 PM: npm WARN config location in the cache, and they are managed by
7:28:38 PM: npm WARN config [`cacache`](http://npm.im/cacache).
7:28:38 PM: > japan-cc@0.1.0 export
7:28:38 PM: > next export
7:28:39 PM: warn - The `target` config is deprecated and will be removed in a future version.
7:28:39 PM: See more info here https://nextjs.org/docs/messages/deprecated-target-config
7:28:39 PM: info - SWC minify release candidate enabled. https://nextjs.link/swcmin
7:28:39 PM: info - using build directory: /opt/build/repo/build
7:28:39 PM: info - Copying "static build" directory
7:28:39 PM: info - No "exportPathMap" found in "/opt/build/repo/next.config.js". Generating map from "./pages"
7:28:39 PM: info - Launching 31 workers
7:28:39 PM: info - Exporting (0/6)
7:28:39 PM: info - Copying "public" directory
7:28:39 PM: info - Exporting (1/6)
7:28:39 PM: info - Exporting (2/6)
7:28:39 PM: info - Exporting (4/6)
7:28:40 PM: Creating deploy upload records
7:28:39 PM: info - Exporting (6/6)
7:28:40 PM: Export successful. Files written to /opt/build/repo/out
7:28:40 PM: β
7:28:40 PM: (build.command completed in 12s)
7:28:40 PM: β
7:28:40 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:40 PM: 2. Deploy site
7:28:40 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:40 PM: β
7:28:40 PM: Starting to deploy site from 'build'
7:28:40 PM: Creating deploy tree
7:28:40 PM: 18 new files to upload
7:28:40 PM: 0 new functions to upload
7:28:41 PM: Site deploy was successfully initiated
7:28:41 PM: β
7:28:41 PM: (Deploy site completed in 740ms)
7:28:41 PM: β
7:28:41 PM: Starting post processing
7:28:41 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:41 PM: Netlify Build Complete
7:28:41 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:28:41 PM: β
7:28:41 PM: Post processing - HTML
7:28:41 PM: (Netlify Build completed in 12.8s)
7:28:41 PM: Caching artifacts
7:28:41 PM: Started saving node modules
7:28:41 PM: Finished saving node modules
7:28:41 PM: Started saving build plugins
7:28:41 PM: Finished saving build plugins
7:28:41 PM: Started saving yarn cache
7:28:41 PM: Post processing - header rules
7:28:41 PM: Post processing - redirect rules
7:28:42 PM: Post processing done
7:28:42 PM: Finished saving yarn cache
7:28:42 PM: Started saving pip cache
7:28:42 PM: Finished saving pip cache
7:28:42 PM: Started saving emacs cask dependencies
7:28:42 PM: Finished saving emacs cask dependencies
7:28:42 PM: Started saving maven dependencies
7:28:42 PM: Finished saving maven dependencies
7:28:42 PM: Started saving boot dependencies
7:28:42 PM: Finished saving boot dependencies
7:28:42 PM: Started saving rust rustup cache
7:28:42 PM: Finished saving rust rustup cache
7:28:42 PM: Started saving go dependencies
7:28:42 PM: Finished saving go dependencies
7:28:42 PM: Build script success
7:28:44 PM: Site is live β¨
7:28:44 PM: Uploading Cache of size 593.4MB
7:28:48 PM: Finished processing build request in 41.972297048s
Thank you so much for helping me with this. Iβm not sure what Iβm doing wrong.