2

I have a next.js project that I am trying to use npm run build on so I can compile it to host on hostinger. Every time I run npm run build it tells me that it complies successfully but I cannot find the folder anywhere. Any suggestions?

I tried changing the script { build: } within the package.json to "react-scripts build && xcopy /f /y build wwwroot", which did not work.

this is my scripts part of my package.json file. { "name": "nextjs-creative-portfolio-starter-code-files", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" },

/** @type {import('next').NextConfig} */ const nextConfig = {}; export default nextConfig; This is my next.config.mjs file

    1 Answer 1

    4

    in your next.config.mjs add this

    /** @type {import('next').NextConfig} */ const nextConfig = { distDir: 'build', }; export default nextConfig; 

    Now if you run next build Next.js will use build instead of the default .next folder.

    source

    1
    • worked as expected.
      – Cuado
      CommentedMar 21 at 13:19

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.