-
SummaryI'm trying to deploy my next 13 app. I don't see any errors while building. When I try to load the app, only HTML shows up, and it shows 404 error for Js, Css and images(as seen in the network tab). Its trying to load from _next folder by default (and this path does not exist) And images directly Unfortunately I can't post the src code. Additional informationFolder structure
My-app
|_ public
|_ assets/
|_[all my images]
|_ nodemodules
|_ .next
|_ out
|_ src
|_ app
|_ Dockerfile
|_ next.config.js
|_ package.json Below are the scripts using next.config.js
dockerfile
package.json
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 14 replies
-
How do you start the server? |
Beta Was this translation helpful? Give feedback.
-
The Fix is Thank you @icyJoseph |
Beta Was this translation helpful? Give feedback.
-
@Ashikpaul I have a similar issue. Any luck figuring out what's causing it? |
Beta Was this translation helpful? Give feedback.
-
This is the one that works for me. |
Beta Was this translation helpful? Give feedback.
-
I'm wondering how this changes at all if I am setting basePath: '/docs', for instance in my next.config.mjs file? Seems like everything works as expected running npm run dev (next dev -p 3002), however, after building DockerFile image it seems the basePath is ignored and I can only access localhost:3002 and all my static files http://localhost:3002/docs/_next/static/chunks/XXXXXXXXX etc. return 404? |
Beta Was this translation helpful? Give feedback.
-
I had update next config to const nextConfig = { locally it works fine but when I deployed in production the build files is in _next folder instead of .next |
Beta Was this translation helpful? Give feedback.
The Fix is
Manually copy the _next folder in dockerfile
For js and css
COPY --from=builder --chown=10101 /app/.next ./_next
For images
COPY --from=builder --chown=10101 /app/public ./public
Thank you @icyJoseph