-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hot reload not working at latest version of Next.js #51162
Comments
I am facing the same problem with the next blog example template: Even when I downgrade my next version to 13.4.0v, it still doesn't work. I am using exactly what the template gave me without making any changes. So I can image the kind of frustrations others who might have used this must have faced. |
Would you mind taking a look at this please? It's really killing dev productivity...(and is very frustrating since we've been spoiled with a super awesome HMR prior to this) Would appreciate it so much! |
So I got a fix for mine. I think the hot reload works. In fact, it has nothing to do with NextJs in my case. The next app was in the mnt/c |
I'm glad you found a solution for yours. I'm not using wsl2 but mine performs full reload for almost every change. Even file saves without any changes causes a full reload. |
I was unable to reproduce using your steps. However, I am having this issue with my own project which started in Looks like custom servers also impact some other performance optimizations (see below from the documentation).
I'll be working on my own workaround without a custom server. Hopefully this helps! |
Yes custom server is the problem hot reload not working with latest next.js version. But it's a requirement as middleware doesn't support node runtime. |
If anyone is using a custom server for https support only, take a look at #53926 Looking for any kind of feedback |
Looks like its working in canary build? The |
@weyert not working for me as of 13.4.19 |
Testing not-found.js on a fresh build also just returns a blank page. Everything worked in 13.4.2 when I test it. |
4 days. Is it just me but the current npx create-next-app@latest is broken. It does not refresh on editing and a simple not-found leaves a blank page. Can someone please confirm that this is true. before i loose my marbles. This is straight out the box, no custom servers - no nothing? |
Could everyone please provide their environment info similar to the original issue? And what is the last version it is working for you? |
Okey this process has gotten me into great confusion. When checking next versions. next-info:
I have tried with @latest and 13.4.20-canary.4 version with the same result as described. next-info from a version that works:
I will say that my current reproduction is just getting @latest and try to edit a page and add not-found.js |
Hey, guys. I also have this problem on the latest version. I switched to version 13.4.15 and that helped me. |
Hey, I think many people are facing this issue, because of the node version. maybe as in the docs, if there is a way to check the node version during development, its better to throw an error/warning to update node version. |
Worked for me. In the last version 13.4.19 I have also bugs with DOM interacting, so I downgrade to this version and all working fine. |
Just like to chime in. I was on node Problems:
I just updated node version to |
I think one thing that might be linked is parallel routes & route groups, I say that because when scouring for solutions I found a Youtuber mention the same problem when he was trying to fix a parallel route problem by adding route groups to it. I'm in such a manic rush trying to get things done I don't have to to make a reproduction but I hope this helps. If it doesn't help give me a nudge and I'll try and reproduce it next week. Here's a clip from the aforementioned Youtuber: EDIT: I updated next and node versions to latest and now the problem only happens with server actions. The server actions do not update unless I refresh the entire server. |
I can confirm using route groups with different runtime per group (edge vs node) will break HMR. We have 3 groups, 1 using edge and 2 using node, and neither has HMR. |
HMR still not working in Firefox 118.0.2 using Next 13.5.6 on MacOS 14.0 |
Mine is a similar issue. Tested with the following versions of stuff
|
HMR still not working in Google Chrome or Brave using Next 13.5.6 on Windows 11 |
This comment has been minimized.
This comment has been minimized.
I just found out my problem was not due to the next.js version but a problem in my layout.tsx. The issue was in my layout.tsx file that was causing hydration / mounting issues because of a dom mismatch. Here is the exact section from documentation
Additionally, don't put any Wrapper Element outside body tag like this:
but make sure that body tag always includes all components
Hope it helps! |
For me updating the node version to the latest fixes the issue, before I was using node version 18.16.0 now it's 20.9.0 |
Having this problem too on my mac. I've been trying to swap node versions (v16.20.2, v20.9.0, v21.1.0) and none of them worked for me.
|
Spent probably three hours trying to find my bug. HMR did not work. Boom it works! Now to pinpoint the problem. Edit: It is not the metadata. I have no fix. Here is my repo:
Edit 4: It works if I downgrade to NextJS 13.2 as suggested in: #57046 (comment) |
For me I had server rendering errors |
So I'm having the same problem and it's definitely a WSL2 thing for me - it works fine from Powershell but Powershell bad, I have copied the project into my WSL2 home dir so no symlinks and identical files. I'm on the latest version of NextJS and Node, both instances function identically except that when run from WSL2 it seems not to watch or hot-reload any saved changes, requiring a full stop and restart every time. I guess I'll put up with having to use Powershell for now but would be great if there was a way to solve this. I started on NextJS 13.5 and Node 16 but have updated each thing independently and tested across both environments, as well as trying all the applicable solutions given in this thread, but HMR continues to fail - accessing pages for the first time after a reload always produces the log I'm pretty sure our code is not the issue here given that it works fine when run in Windows over WSL. |
I found a strange bug that seems related - hopefully this helps someone. I was importing components from This didn't throw any errors and seemed to all be working fine other than the hot reload. |
It looks like this MR broke it when using assetPrefix: |
HMR is failing for me even when starting out with a fresh next app.
I haven't changed anything other than testing a text change to test HMR. next: 14.2.3 Have to restart the next server |
This is happening to me too. It's not every time but it's enough of the time to make it really annoying and slow down my productivity! next: 14.2.3 I was coding on other projects 2 weeks ago and it was working fine. Took a weeks break then came back this week and it's not working... |
I can confirm this is what is causing the issue on my end. If I comment out When inspecting the network the websocket (/_next/webpack-hmr) never connects with |
Same for me: assetPrefix breaks hot reload. |
Just in case you are using This worked for me hope it worked for you too |
I can confirm that, after either commenting out Node: 20.14.0 Also worth a read: https://nextjs.org/docs/app/api-reference/next-config-js/assetPrefix. |
For |
encountered same issue, setting assetPrefix to undefined in dev mode solved it |
@jarvislin94 Could not find a valid reproduction, please reopen with repro if the issue is still ongoing, I'll prioritize and take a look. Thank you! @andrei9669 @nsturdivant @ThanhHung2112 For those who are having issue with the Note An assetPrefix set to a full URL e.g. CDN should be only used in Prod. |
@ThanhHung2112 @MdSadiqMd @CassWindred @kelvinsekx |
It has nothing to do with NextJS so don't dig it I would say. If you are working with WSL2, work in your home directory. In fact, for other projects that isn't Next related, I encountered same experience, and switching paths did justice. |
@devjiwonchoi Yes my comment specify to move the application to native path(WSL2) nothing more than that with respect to my comment |
Same for me - upgrading from next 12 -> next 14.. Hot Reloading stopped working Commenting out |
@jamesryan-dev Hey, I'd really love to take a look at your case. |
Hi @devjiwonchoi we are not using CDN Here is our, now working config:
|
@jamesryan-dev Hey, thanks for reporting. In your case, setting
This fix was released to the canary version v15.0.0-canary.107, and will going to be added to the next available stable version. Once again, thank you for reporting your case! Also, if you are not using the development "phase" you can use in next config, feel free to check it out to replace your x-ref: https://nextjs.org/docs/app/api-reference/next-config-js/assetPrefix#set-up-a-cdn |
Actually mine wasn't working because i was using group routes in next js. So in one of the route layout, I didn't include the html and body element.
After
|
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. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103 Binaries: Node: 18.16.0 npm: 9.5.1 Yarn: 1.22.19 pnpm: 8.5.1 Relevant packages: next: 13.4.5-canary.12 eslint-config-next: 13.4.5 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
To Reproduce
Describe the Bug
Expected Behavior
Hot reload should work
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: