Next.js Discord

Discord Forum

Difference `npm run dev` and `npm run build` with `npm start`

Unanswered
American posted this in #help-forum
Open in Discord
AmericanOP
Hi folks, I'm new to React JS and Next JS.
When I run the project via npm run dev command everything looks fine. However when I run npm run build with npm start it has missing UI/actions/requests.
Question: What is the main difference between npm run dev and npm run build with npm start? I am trying to run a project in a docker container. Any suggestion?

27 Replies

AmericanOP
Hi, thanks for your reply. I confirm that there is no such output: 'standalone' in the next.config.js file. Should I add it to the next.config.js file?
I added it but it didn't help.
AmericanOP
Yes I've run npm run build with npm start. without in docker.
AmericanOP
Yes using it with tailwind.
@Ray how did you create the project? with create-next-app?
AmericanOP
I don't know exactly. I'll ask.
Project structure:
@American I don't know exactly. I'll ask. Project structure:
have you imported the global.css in layout.tsx?
AmericanOP
Yes
can you try deploy it on vercel and share the url to me?
AmericanOP
Sorry, I can't. what exactly are you trying to check? I will provide to you.
check the url for the css
AmericanOP
is that what you mean?
is it accessible?
AmericanOP
Yes
but no style applied on the html?
AmericanOP
they are used
ah what do you mean missing UI/actions/requests?
AmericanOP
Missing UI:
active chat panel missing
Missing requests:
first request missing in build version.
is the page static generated? and doing client side fetching?
AmericanOP
It's dynamic generated and doing it client side
AmericanOP
Thanks! I've fixed it. It turns out that the wrong logic was written in useEffect