Difference `npm run dev` and `npm run build` with `npm start`
Unanswered
American posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
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
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
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
?![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
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.
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
are you trying it with just
npm run build
and npm start
or in docker?![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Yes I've run
npm run build
with npm start
. without in docker.![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
no css? are you using it with tailwind?
how did you create the project? with create-next-app?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Yes using it with tailwind.
I don't know exactly. I'll ask.
Project structure:
Project structure:
![Image](https://cdn.discordapp.com/attachments/1187635049252782111/1187665631378686002/image.png?ex=6597b6d0&is=658541d0&hm=7943f3de1f68865c4fe0ccd64c08dbc40ce87ed1058a7e49d393c674dda70cf7&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
have you imported the
global.css
in layout.tsx?![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Yes
![Image](https://cdn.discordapp.com/attachments/1187635049252782111/1187666572144291880/image.png?ex=6597b7b0&is=658542b0&hm=35a94256ccfb38787cb5152c2fb86b5654ace07511f6f9a9e9106bd271aea478&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
can you try deploy it on vercel and share the url to me?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Sorry, I can't. what exactly are you trying to check? I will provide to you.
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
check the url for the css
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
is that what you mean?
![Image](https://cdn.discordapp.com/attachments/1187635049252782111/1187670861440897024/image.png?ex=6597bbaf&is=658546af&hm=b4c17b3b7a5c291452a1aa052d3d9564fe1b37127d21fbf27d2671e4f1120fb0&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
is it accessible?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Yes
![Image](https://cdn.discordapp.com/attachments/1187635049252782111/1187674303567761488/image.png?ex=6597bee3&is=658549e3&hm=bd556b2d5e77dbfe6ff3add09c7ba2dcf7f07d51ba494c9bc3c2b8976e95e6c6&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
but no style applied on the html?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
they are used
![Image](https://cdn.discordapp.com/attachments/1187635049252782111/1187674757936717884/image.png?ex=6597bf50&is=65854a50&hm=75210bbabac4f198deaaae2f1653f07290075eb5a6074c4854cb8ff31cb9d9bd&)
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
ah what do you mean missing UI/actions/requests?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Missing UI:
![Image](https://cdn.discordapp.com/attachments/1187635049252782111/1187676982717186149/SPOILER_npm_run_dev_version.png?ex=6597c162&is=65854c62&hm=fda3b5628c9fe8c18f0591217394aa3c54b65949c5419dbddf9e35ffe97b4106&)
active chat panel missing
Missing requests:
first request missing in build version.
first request missing in build version.
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
is the page static generated? and doing client side fetching?
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
It's dynamic generated and doing it client side
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
AmericanOP
Thanks! I've fixed it. It turns out that the wrong logic was written in
useEffect