Images are not showing on production page

  • netlify site name.
    Example: https://dainty-granita-eef4f3.netlify.app/
    *issues – Images are not showing, I had use public folders for storing the images and use the
    link "import {photo } from “…/public/images” "

File structure
app
Component
–main
Public

  • Build problems – build was successful
    Here is the full code –
    9:43:56 PM: Starting post processing
    9:43:56 PM: Skipping HTML post processing
    9:43:57 PM: Post processing - header rules
    9:43:57 PM: Post processing - redirect rules
    9:43:57 PM: Post processing done
    9:43:57 PM: Section completed: postprocessing
    9:43:58 PM: Site is live :sparkles:
    9:42:50 PM: build-image version: 73f16e520fdddf409be6f578c8c2c8941bdf32d3 (focal)
    9:42:50 PM: buildbot version: aae36d37bb0728ee6dc52d97c5e1b5b83720773e
    9:42:50 PM: Fetching cached dependencies
    9:42:50 PM: Starting to download cache of 270.7MB
    9:42:55 PM: Finished downloading cache in 5.302s
    9:42:55 PM: Starting to extract cache
    9:42:57 PM: Finished extracting cache in 2.059s
    9:42:57 PM: Finished fetching cache in 7.411s
    9:42:57 PM: Starting to prepare the repo for build
    9:42:58 PM: Preparing Git Reference refs/heads/main
    9:42:59 PM: Starting to install dependencies
    9:42:59 PM: Python version set to 3.8
    9:42:59 PM: Attempting Ruby version 2.7.2, read from environment
    9:43:00 PM: Using Ruby version 2.7.2
    9:43:00 PM: Started restoring cached go cache
    9:43:00 PM: Finished restoring cached go cache
    9:43:02 PM: Installing Go version 1.19.13 (requested 1.19.x)
    9:43:07 PM: go version go1.19.13 linux/amd64
    9:43:07 PM: Using PHP version 8.0
    9:43:08 PM: Started restoring cached Node.js version
    9:43:09 PM: Finished restoring cached Node.js version
    9:43:09 PM: v18.18.0 is already installed.
    9:43:09 PM: Now using node v18.18.0 (npm v9.8.1)
    9:43:09 PM: Enabling Node.js Corepack
    9:43:10 PM: Started restoring cached build plugins
    9:43:10 PM: Finished restoring cached build plugins
    9:43:10 PM: WARNING: The environment variable ‘NODE_ENV’ is set to ‘production’. Any ‘devDependencies’ in package.json will not be installed
    9:43:10 PM: Started restoring cached corepack dependencies
    9:43:10 PM: Finished restoring cached corepack dependencies
    9:43:10 PM: No npm workspaces detected
    9:43:10 PM: Started restoring cached node modules
    9:43:10 PM: Finished restoring cached node modules
    9:43:10 PM: Installing npm packages using npm version 9.8.1
    9:43:11 PM: up to date, audited 476 packages in 659ms
    9:43:11 PM: 143 packages are looking for funding
    9:43:11 PM: run npm fund for details
    9:43:11 PM: found 0 vulnerabilities
    9:43:11 PM: npm packages installed
    9:43:11 PM: Install dependencies script success
    9:43:11 PM: Starting build script
    9:43:12 PM: Detected 1 framework(s)
    9:43:12 PM: next at version 13.4.19
    9:43:12 PM: Section completed: initializing
    9:43:14 PM:
    9:43:14 PM: Netlify Build
    9:43:14 PM: ────────────────────────────────────────────────────────────────
    9:43:14 PM:
    9:43:14 PM: ❯ Version
    9:43:14 PM: @netlify/build 29.21.1
    9:43:14 PM:
    9:43:14 PM: ❯ Flags
    9:43:14 PM: baseRelDir: true
    9:43:14 PM: buildId: 6509c880312e511a6c6d820f
    9:43:14 PM: deployId: 6509c880312e511a6c6d8211
    9:43:14 PM:
    9:43:14 PM: ❯ Current directory
    9:43:14 PM: /opt/build/repo
    9:43:14 PM:
    9:43:14 PM: ❯ Config file
    9:43:14 PM: No config file was defined: using default values.
    9:43:14 PM:
    9:43:14 PM: ❯ Context
    9:43:14 PM: production
    9:43:14 PM:
    9:43:14 PM: ❯ Using Next.js Runtime - v4.40.1
    9:43:15 PM:
    9:43:15 PM: @netlify/plugin-nextjs (onPreBuild event)
    9:43:15 PM: ────────────────────────────────────────────────────────────────
    9:43:15 PM:
    9:43:15 PM: Next.js cache restored.
    9:43:15 PM: Netlify configuration property build.environment.NEXT_PRIVATE_TARGET value changed.
    9:43:15 PM:
    9:43:15 PM: (@netlify/plugin-nextjs onPreBuild completed in 145ms)
    9:43:15 PM:
    9:43:15 PM: Build command from Netlify app
    9:43:15 PM: ────────────────────────────────────────────────────────────────
    9:43:15 PM:
    9:43:15 PM: $ npm run build
    9:43:15 PM: > bookstore@0.1.0 build
    9:43:15 PM: > next build
    9:43:16 PM: - info Creating an optimized production build…
    9:43:22 PM: - info Compiled successfully
    9:43:22 PM: - info Linting and checking validity of types…
    9:43:24 PM: - info Collecting page data…
    9:43:25 PM: - info Generating static pages (0/5)
    9:43:26 PM: - info Generating static pages (1/5)
    9:43:26 PM: - info Generating static pages (2/5)
    9:43:26 PM: - info Generating static pages (3/5)
    9:43:26 PM: - info Generating static pages (5/5)
    9:43:27 PM: - info Finalizing page optimization…
    9:43:27 PM: Route (app) Size First Load JS
    9:43:27 PM: ┌ ○ / 7.52 kB 91.8 kB
    9:43:27 PM: ├ ○ /favicon.ico 0 B 0 B
    9:43:27 PM: └ ○ /modal 137 B 78.6 kB
    9:43:27 PM: + First Load JS shared by all 78.5 kB
    9:43:27 PM: ├ chunks/596-1f2608a42259096f.js 26.1 kB
    9:43:27 PM: ├ chunks/fd9d1056-9200b628bfbdc6da.js 50.5 kB
    9:43:27 PM: ├ chunks/main-app-0b9d5551314b1fc9.js 218 B
    9:43:27 PM: └ chunks/webpack-75097f33e958295f.js 1.72 kB
    9:43:27 PM: Route (pages) Size First Load JS
    9:43:27 PM: ─ ○ /404 182 B 76.5 kB
    9:43:27 PM: + First Load JS shared by all 76.3 kB
    9:43:27 PM: ├ chunks/framework-8883d1e9be70c3da.js 45.1 kB
    9:43:27 PM: ├ chunks/main-af70ef5928c94903.js 29.4 kB
    9:43:27 PM: ├ chunks/pages/_app-52924524f99094ab.js 195 B
    9:43:27 PM: └ chunks/webpack-75097f33e958295f.js 1.72 kB
    9:43:27 PM: ○ (Static) automatically rendered as static HTML (uses no initial props)
    9:43:27 PM:
    9:43:27 PM: (build.command completed in 12.3s)
    9:43:27 PM:
    9:43:27 PM: @netlify/plugin-nextjs (onBuild event)
    9:43:27 PM: ────────────────────────────────────────────────────────────────
    9:43:27 PM:
    9:43:27 PM: Moving static page files to serve from CDN…
    9:43:27 PM: Moved 6 files
    9:43:27 PM: You are not using Netlify Edge Functions for image format detection. Set env var NEXT_FORCE_EDGE_IMAGES=true to enable.
    9:43:27 PM: Netlify configuration property redirects value changed to [
    9:43:27 PM: { from: ‘/next/static/', to: ‘/static/:splat’, status: 200 },
    9:43:27 PM: {
    9:43:27 PM: from: '/_next/image
    ’,
    9:43:27 PM: query: { url: ‘:url’, w: ‘:width’, q: ‘:quality’ },
    9:43:27 PM: to: '/ipx/w:width,q
    :quality/:url’,
    9:43:27 PM: status: 301
    9:43:27 PM: },
    9:43:27 PM: { from: ‘/_ipx/', to: ‘/.netlify/builders/_ipx’, status: 200 },
    9:43:27 PM: {
    9:43:27 PM: from: '/api/
    ’,
    9:43:27 PM: to: ‘/.netlify/functions/___netlify-handler’,
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 0.png’,
    9:43:27 PM: to: ‘/asset 0.png’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 1.jpeg’,
    9:43:27 PM: to: ‘/asset 1.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 10.jpeg’,
    9:43:27 PM: to: ‘/asset 10.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 11.jpeg’,
    9:43:27 PM: to: ‘/asset 11.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 12.jpeg’,
    9:43:27 PM: to: ‘/asset 12.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 13.jpeg’,
    9:43:27 PM: to: ‘/asset 13.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 14.jpeg’,
    9:43:27 PM: to: ‘/asset 14.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 15.jpeg’,
    9:43:27 PM: to: ‘/asset 15.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 16.jpeg’,
    9:43:27 PM: to: ‘/asset 16.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 17.jpeg’,
    9:43:27 PM: to: ‘/asset 17.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 18.jpeg’,
    9:43:27 PM: to: ‘/asset 18.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 19.jpeg’,
    9:43:27 PM: to: ‘/asset 19.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 2.jpeg’,
    9:43:27 PM: to: ‘/asset 2.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 20.jpeg’,
    9:43:27 PM: to: ‘/asset 20.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 3.jpeg’,
    9:43:27 PM: to: ‘/asset 3.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 4.jpeg’,
    9:43:27 PM: to: ‘/asset 4.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 5.jpeg’,
    9:43:27 PM: to: ‘/asset 5.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 6.jpeg’,
    9:43:27 PM: to: ‘/asset 6.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 7.jpeg’,
    9:43:27 PM: to: ‘/asset 7.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 8.jpeg’,
    9:43:27 PM: to: ‘/asset 8.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/asset 9.jpeg’,
    9:43:27 PM: to: ‘/asset 9.jpeg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/next.svg’,
    9:43:27 PM: to: ‘/next.svg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/vercel.svg’,
    9:43:27 PM: to: ‘/vercel.svg’,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: status: 200
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: ‘/',
    9:43:27 PM: to: ‘/.netlify/functions/___netlify-handler’,
    9:43:27 PM: status: 200,
    9:43:27 PM: conditions: { Cookie: [Array] },
    9:43:27 PM: force: true
    9:43:27 PM: },
    9:43:27 PM: {
    9:43:27 PM: from: '/
    ’,
    9:43:27 PM: to: ‘/.netlify/functions/___netlify-handler’,
    9:43:27 PM: status: 200
    9:43:27 PM: }
    9:43:27 PM: ].
    9:43:27 PM:
    9:43:27 PM: (@netlify/plugin-nextjs onBuild completed in 142ms)
    9:43:27 PM:
    9:43:27 PM: Functions bundling
    9:43:27 PM: ────────────────────────────────────────────────────────────────
    9:43:27 PM:
    9:43:27 PM: Packaging Functions from .netlify/functions-internal directory:
    9:43:27 PM: - ___netlify-handler/___netlify-handler.js
    9:43:27 PM: - ___netlify-odb-handler/___netlify-odb-handler.js
    9:43:27 PM: - _ipx/_ipx.js
    9:43:27 PM:
    9:43:45 PM:
    9:43:45 PM: (Functions bundling completed in 17.3s)
    9:43:45 PM:
    9:43:45 PM: Edge Functions bundling
    9:43:45 PM: ────────────────────────────────────────────────────────────────
    9:43:45 PM:
    9:43:45 PM: Packaging Edge Functions from .netlify/edge-functions directory:
    9:43:45 PM: - rsc-data
    9:43:45 PM:
    9:43:45 PM: (Edge Functions bundling completed in 527ms)
    9:43:45 PM:
    9:43:45 PM: @netlify/plugin-nextjs (onPostBuild event)
    9:43:45 PM: ────────────────────────────────────────────────────────────────
    9:43:45 PM:
    9:43:45 PM: Next.js cache saved.
    9:43:45 PM: :test_tube: Thank you for testing appDir support on Netlify. For known issues and to give feedback, visit Using the Next 13 `app` directory on Netlify · netlify/next-runtime · Discussion #1724 · GitHub
    9:43:45 PM:
    9:43:45 PM: (@netlify/plugin-nextjs onPostBuild completed in 206ms)
    9:43:45 PM:
    9:43:45 PM: Deploy site
    9:43:45 PM: ────────────────────────────────────────────────────────────────
    9:43:45 PM:
    9:43:46 PM: Starting to deploy site from ‘.next’
    9:43:46 PM: Calculating files to upload
    9:43:46 PM: 10 new files to upload
    9:43:46 PM: 3 new functions to upload
    9:43:56 PM: Section completed: deploying
    9:43:56 PM: Site deploy was successfully initiated
    9:43:56 PM:
    9:43:56 PM: (Deploy site completed in 10.6s)
    9:43:56 PM:
    9:43:56 PM: Netlify Build Complete
    9:43:56 PM: ────────────────────────────────────────────────────────────────
    9:43:56 PM:
    9:43:56 PM: (Netlify Build completed in 42.6s)
    9:43:57 PM: Caching artifacts
    9:43:57 PM: Started saving node modules
    9:43:57 PM: Finished saving node modules
    9:43:57 PM: Started saving build plugins
    9:43:57 PM: Finished saving build plugins
    9:43:57 PM: Started saving corepack cache
    9:43:57 PM: Finished saving corepack cache
    9:43:57 PM: Started saving pip cache
    9:43:57 PM: Finished saving pip cache
    9:43:57 PM: Started saving emacs cask dependencies
    9:43:57 PM: Finished saving emacs cask dependencies
    9:43:57 PM: Started saving maven dependencies
    9:43:57 PM: Finished saving maven dependencies
    9:43:57 PM: Started saving boot dependencies
    9:43:57 PM: Finished saving boot dependencies
    9:43:57 PM: Started saving rust rustup cache
    9:43:57 PM: Finished saving rust rustup cache
    9:43:57 PM: Started saving go dependencies
    9:43:57 PM: Finished saving go dependencies
    9:43:57 PM: Build script success
    9:43:57 PM: Section completed: building
    9:43:58 PM: Uploading Cache of size 270.5MB
    9:44:01 PM: Section completed: cleanup
    9:44:01 PM: Finished processing build request in 1m10.931s

Please give solution to my problem

Hi @Mayank_08 , Welcome to the Netlify Support Forums and thanks for the post.
Kindly take a look at the Next.js Official Documentation below on how to properly use images if you have not done so already.

Also regarding static assets kindly check the documentation below.

Thanks.

1 Like