Next.js Discord

Discord Forum

Do I have to upload whole project to VM and Build there?

Answered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
Or can I build production on my laptop and only upload the resulting build? Right now my project is 225mb without .next folder. Howevr it grows to 600mb after build. I don't have a lot of space on VM and also it takes a while to upload/download from GitHub so I'd like to know if there is an alternative.

21 Replies

Answer
then just copy the folder in .next/standalone to your VM
Saltwater CrocodileOP
Thank you
On it
remember to copy the static and public folder too
like the doc said
Saltwater CrocodileOP
âš  The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated
âš  "next start" does not work with "output: standalone" configuration. Use "node .next/standalone/server.js" instead.
✓ Ready in 995ms
⨯ The requested resource isn't a valid image for /sticker.png received text/html; charset=utf-8
⨯ The requested resource isn't a valid image for /sticker.png received text/html; charset=utf-8
page loads but without css and resources
@Ray remember to copy the static and public folder too
yeah like I said, you need to copy the public folder and the static folder
public to .next/standalone/public
.next/static to .next/standalone/.next/static
Saltwater CrocodileOP
I put static inside Build and css loaded however I'm still missing some images
Saltwater CrocodileOP
sorry i was building to a separate folder, now i am going to build default way and try again
app-i18n.next\standalone> node server.js
â–² Next.js 14.0.4
- Local: http://localhost:3000
- Network: http://0.0.0.0:3000

✓ Ready in 138ms
⨯ The requested resource isn't a valid image for /sticker.png received text/html; charset=utf-8
⨯ The requested resource isn't a valid image for /sticker.png received text/html; charset=utf-8
i don't have public
@Ray `public` to `.next/standalone/public` `.next/static` to `.next/standalone/.next/static`
Saltwater CrocodileOP
I was looking for public in .next/public 😄
thank you this solved my issue