next.js
next.js copied to clipboard
WSL2 Compiling taking a while
Link to the code that reproduces this issue
https://github.com/quentinjeanningros/next_wsl_issue
To Reproduce
the repo I shared has the same problem, but it's not with this one that I've found the solution. I just created an empty project to share the problem.
I have a casual Next project, when running npm run dev
, it work till I try to open localhost.
Each process work fine but as soon as I open localhost:3000
, compiling appear in the terminal and here I have too long loading.
After a while (15 min) the project open itself.
Crtl+C
close the process, I can type command, but not kill it it think, because if I run local npm run dev
again it use port 3001 and port 3000 continue to load.
Verify canary release
I verified that the issue exists in the latest Next.js canary release
Current vs. Expected behavior
The repository I shared has the same issue, but I didn't find the solution with this one. I simply created an empty project for review purposes.
I have a casual Next.js project. When I run npm run dev
, it works until I try to open localhost. Each process works fine, but as soon as I open localhost:3000
, compilation appears in the terminal, and then there's an excessively long loading time. After about 15 minutes, the project finally opens.
Pressing Ctrl+C
closes the process, and I can type commands, but it seems I can't kill it completely because if I run npm run dev
again locally, it uses port 3001 and port 3000 continues to load.
The project I'm working on is actually huge, but on my previous WSL2 build (from a month ago) and on a colleague's Apple M2, it only takes 2 minutes to build. Everything is stored at /home/user/...
, so I optimized my WSL setup accordingly.
One major difference between the repository and the actual real project is that we use a mono-repo. Many external components are built individually, which can then be used in each project.
This issue started occurring after updating Next.js from version 13.* to 14.0.4. Even updating to 14.1.0 did not resolve the issue. And rolling back to 13.4.19 solve the issue
Provide environment information
I am using
- WSL2
- Ubuntu 22.04.3 LTS. Node V20.11.0
- [email protected]
- next: ^14.0.4 also try with the 14.1.0
- turbo
It's not a performance issue here what `ulimit -a` return
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) unlimited
-s: stack size (kbytes) 8192
-c: core file size (blocks) 0
-m: resident set size (kbytes) unlimited
-u: processes 128215
-n: file descriptors 1048576
-l: locked-in-memory size (kbytes) 65536
-v: address space (kbytes) unlimited
-x: file locks unlimited
-i: pending signals 128215
-q: bytes in POSIX msg queues 819200
-e: max nice 0
-r: max rt priority 0
-N 15: unlimited
### Which area(s) are affected? (Select all that apply)
Not sure
### Which stage(s) are affected? (Select all that apply)
next dev (local)
### Additional context
This issue started occurring after updating Next.js from version 13.* to 14.0.4. Even updating to 14.1.0 did not resolve the issue.
I'm also getting this on wsl2, just takes forever. downgrading doesn't fix the problem for me, but it is greatly reduced (30 seconds to load my main page, vs...4 minutes and still not loaded...). I'm using --turbo
Downgrading to 3.X.X doesn't reduce your compilation time ?
Are all your files in the WSL folder ? Example : /home/user/...
It takes me 2-3 minutes using 3.X.X which look fair, WSL is like a VM so I expect moderated performances, if you try to run a massive project is big, 4 minutes for a first run look ok.
But for sure, 4.X.X have an issue with WSL2 (maybe on WSL1 too). It's take around 15 minutes for me to compile.
I also use turbo
@Sparticuz if you have a repo with a better example than mine fill free to share it. Mine might not help
Taking some time to clean our code, we see that we use multiple version of next in the same project, and we had multiple other package issue.
Clean the code, fix everything. I close the issue here. There is no issue at all with next 14.x.x with WSL2 for now.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.