vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.5k stars 27.04k forks source link

npm run dev never finish to compile #66729

Open arilishu opened 5 months ago

arilishu commented 5 months ago

Link to the code that reproduces this issue

https://github.com/vercel/next-learn/tree/main/basics/learn-starter

To Reproduce

This is happening everywhere on my computer, doesn't matter if it's an old or new project. I just create a new folder, run:

npx create-next-app@latest
npm run dev

it will show:

dev
> next dev

  ▲ Next.js 14.2.3
  - Local:        http://localhost:3000

 ✓ Starting...
 ✓ Ready in 3.5s

And that's all, never move forward to the Compiling process Link with a video

Current vs. Expected behavior

it should compile the site and leave it ready to run on localhost:3000

Provide environment information

MAC Os Sonoma 14.5
Apple M2
npm 10.7.0
nvm 0.39.7

Which area(s) are affected? (Select all that apply)

create-next-app, Developer Experience, Script (next/script)

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

This morning i uninstalled JAVA, and then reinstalled the latest version. That's all I can tell

icyJoseph commented 5 months ago

Hi,

The compiler is "lazy", so you have to actually hit an endpoint for it to process it. Go to a browser, or from the CLI cURL, to localhost:3000 and that'll compile that page.

palaklive commented 5 months ago

I am encountering a same issue on a Mac system with the following configuration:

As a temporary workaround, I have found that adding the --turbo flag to the dev server resolves the issue. However, I believe a more robust solution is needed to address the root cause of the problem.

Furthermore, I am experiencing an issue with the build process, where it becomes stuck with the message Creating an optimized production build....

@timneutkens, I would be grateful if you could assist with this issue. Thank you for your time and consideration."

arilishu commented 5 months ago

Hi,

The compiler is "lazy", so you have to actually hit an endpoint for it to process it. Go to a browser, or from the CLI cURL, to localhost:3000 and that'll compile that page.

After trying that approach it's working. But it's taking long time to compile every single page. here is an example every time I make an update the time it takes to compile: ✓ Compiled /favicon.ico in 2.7s (2693 modules) ✓ Compiled in 2.6s (2693 modules) ○ Compiling /product-detail/[id] ... ✓ Compiled /product-detail/[id] in 69.7s (2788 modules) ✓ Compiled in 4.5s (2773 modules) ✓ Compiled in 1933ms (2759 modules) ○ Compiling /login ... ✓ Compiled /login in 40.3s (2836 modules)

Any idea what could be wrong?

palaklive commented 4 months ago

I manually defined the port with "dev": "next dev -p 3001", and it started working.

arilishu commented 4 months ago

I manually defined the port with "dev": "next dev -p 3001", and it started working.

The issue is not related to the port. I have tried lot of ports but the errors still the same.

timneutkens commented 1 month ago

Can you try running with Turbopack (--turbopack) on Next.js 15 and let me know if you're still running into issues?