#nextjs stuck on compiling
1 messages · Page 1 of 1 (latest)
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+ missingfavicon.icocan cause an infinite compile loop ofglobal-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:
-
Disable Turbopack temporarily and see if it compiles:
npx next dev --no-turbopackor remove
--turbopackfrom your dev script if you added it. -
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]
-
If you have
opengraph-image.tsx/twitter-image.tsxand a missingfavicon.ico, add a simplepublic/favicon.icofile or temporarily remove the Open Graph route to see if the loop stops. [Infinite compiling] -
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 cacheusage. - 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:
- Next 15 dev server hanging on Windows when the project is on a non‑system drive (e.g.
D:). [Dev server hangs on D] - Dev server stuck on compiling when connected to certain VPNs or network interfaces. [Network compile hang 1; Network compile hang 2]
If this might apply:
- Try moving the project to your system drive (e.g.
C:on Windows) and runnext devthere. [Dev server hangs on D] - Disconnect VPN / extra network adapters and retry
next dev. [Network compile hang 1]
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:
- Create the smallest repo where
next devornext buildhangs (remove unrelated pages/deps). - Note:
- Next.js version
- Node version
- OS and whether Turbopack is on
- Compare your symptoms to:
- 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:vsD:) - Whether you have
opengraph-image.tsx, WASM, oruse cache