Difference `npm run dev` and `npm run build` with `npm start`
Unanswered
American posted this in #help-forum
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?
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
Ray
npm run dev
will start the dev servernpm run build
then npm start
will create a production build and start the serverit has missing UI/actions/requests.do you have
output: 'standalone'
in next.config.js
?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.
Ray
are you trying it with just
npm run build
and npm start
or in docker?AmericanOP
Yes I've run
npm run build
with npm start
. without in docker.Ray
no css? are you using it with tailwind?
how did you create the project? with create-next-app?
AmericanOP
Yes using it with tailwind.
I don't know exactly. I'll ask.
Project structure:
Project structure:
Ray
have you imported the
global.css
in layout.tsx?AmericanOP
Yes
Ray
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.
Ray
check the url for the css
AmericanOP
is that what you mean?
Ray
is it accessible?
AmericanOP
Yes
Ray
but no style applied on the html?
AmericanOP
they are used
Ray
ah what do you mean missing UI/actions/requests?
AmericanOP
Missing UI:
active chat panel missing
Missing requests:
first request missing in build version.
first request missing in build version.
Ray
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