#nextjs stuck on compiling

1 messages · Page 1 of 1 (latest)

burnt owlBOT
#

Hi @silver shadow. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Several open issues describe “Compiling…” hanging indefinitely in recent Next.js versions, especially with Turbopack and certain patterns. Based on those, here are concrete checks and workarounds you can try.

Because I don’t know your exact version or setup, some of these may not apply; the docs/issues don’t give a single universal fix.


1. Check for known Turbopack hangs

If you’re on Next 15 or 16 and using Turbopack (next dev --turbopack or the default in 16), there are multiple reports of the dev server getting stuck on “Compiling”:

  • Next 16 + opengraph-image.tsx + missing favicon.ico can cause an infinite compile loop of global-error.tsx. [Infinite compiling]
  • Entering a non‑existent URL or leaving an old dev tab open from another project can cause “Compiling” to never finish. [Wrong URL hang]
  • Loading certain WASM binaries (e.g. duckdb) with Turbopack can hang compilation forever. [Wasm hang]
  • Large Tailwind codebases with Turbopack can hang on “Compiling”. [Tailwind hang]

What to try:

  1. Disable Turbopack temporarily and see if it compiles:

    npx next dev --no-turbopack
    

    or remove --turbopack from your dev script if you added it.

  2. Close all old dev tabs from other Next.js projects, especially ones that were using the same port, then restart next dev. [Wrong URL hang]

#
  1. If you have opengraph-image.tsx / twitter-image.tsx and a missing favicon.ico, add a simple public/favicon.ico file or temporarily remove the Open Graph route to see if the loop stops. [Infinite compiling]

  2. If you’re loading a WASM binary (duckdb or similar), comment that code out and restart dev to confirm whether it’s the cause. [Wasm hang]


2. Build hangs vs dev hangs (cache / use cache)

If your build (not dev) hangs around “Linting and checking validity of types” or similar, there’s a known issue where an existing .next cache causes the build to hang. [Type-check hang]

You said you cleared cache, but to be explicit:

rm -rf .next
npm run build

If you’re using the use cache directive, the docs say builds can hang if cached functions indirectly depend on runtime-only Promises (e.g. cookies(), headers(), or dynamic fetches stored in shared Maps). [use cache troubleshooting]

If that matches your code, try:

  • Removing or simplifying use cache usage.
  • Avoid passing Promises with runtime data into cached functions or shared Maps.

3. Environment-specific hangs

There are reports of hangs that only occur in specific environments:

If this might apply:

#

4. If it’s still stuck

The issues above show that some hangs are genuine framework bugs that require a minimal reproduction for the Next.js team to fix. [Build hangs; Node 22 hangs]

If none of the steps help:

  1. Create the smallest repo where next dev or next build hangs (remove unrelated pages/deps).
  2. Note:
    • Next.js version
    • Node version
    • OS and whether Turbopack is on
  3. Compare your symptoms to:
  4. If it matches one, follow any workarounds there; if not, you may need to open a new GitHub issue with your reproduction.

If you share:

  • Next.js version
  • Whether you’re using Turbopack
  • OS and where the project lives (e.g. C: vs D:)
  • Whether you have opengraph-image.tsx, WASM, or use cache

I can narrow this down to the most likely known issue from the list above.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: