Why does my React app get stuck compiling in Docker?

0
3
Asked By TechieNinja42 On

I'm having trouble getting my React app to work with Docker. When I set up a Dockerfile and try to run the app, it starts compiling and just never stops. I've even created a brand new Next.js application and faced the same issue. Here's my Dockerfile for reference: I'm using Node version 24.13 on Alpine, and after setting the work directory and copying over package.json, I run `npm install`. The app seems to set up fine, but when I access localhost:3000, it stays stuck on 'Compiling /...' until my RAM gets full and I have to restart my computer.

2 Answers

Answered By CodeWizard101 On

It sounds like your app might be stuck in a build loop. Could you share the build logs with us? Also, have you tried replacing `npm install` with `npm ci`? That sometimes helps with dependency issues.

CuriousDev92 -

I haven't tried `npm ci` yet. Here are the build logs:

[Build details here]

The build seems to finish as expected, but it just won't load the app in the browser.

TechieNinja42 -

Thanks for the tip! I'll try that and see if it resolves the compiling issue.

Answered By DevGuru33 On

Make sure you're using the right command to start your app. Try making the entry point to your Docker container `npm run dev` in your `docker-compose.yml` file. You might need to add it under the command section there.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.