-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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 Reloading Not Working #13918
Comments
I can't reproduce this on my machine, please try Node v10 or v11 👍 |
@LekoArts I've tried running the same procedure with both Node v10 and v11 with the exact same result. Is there anything else I should try or do you need more information about something? |
Can you try another operating system or code editor? We'd need to find some sort of reproduction or information on how to reproduce this issue :O |
@AGreenObject Could you inspect the console in your browser and check if the web socket calls (that enable HMR) are being completed? Perhaps this has to do with web sockets being blocked in your network stack or something? |
I can confirm I have the same issue. When I change the title in the gatsby config, the title just disappears. I have to redeploy the project in order for it to run properly and apply the change |
@rori4 we sadly don't do HMR for gatsby-node, gatsby-config or gatsby-browser. You'll need to rerun |
@sidharthachatterjee I'll check this out when I get home this evening. |
@sidharthachatterjee looks like the web socket isn't being blocked. |
@LekoArts I've tried another operating system, Windows 10 Home, 10.0.0.17763 Build 17763, using powershell--and I've gotten hot reloading to work. I'm not exactly sure what the issue is/was, but I can tell you that I was using Ubuntu on the WSL (Windows Subsystem for Linux), and I assume the issue that I was having must have something to do with this. |
can you see if anything is being emitted through the websocket by watching eventstream. Could you also try to update |
Hi, I am having problems with hot reloading as well. Have been on and off, but today was really bad. I updated all my gatsby related plugins in case if there were some straggling version 1 or border version 2 straggling there (started with the gatsby default starter which I downloaded from the repo), and this is what I am working with now:
Strangely, I also have been getting the following re Workbox in the Chrome DevTools Console:
Is that supposed to be happening? I do not use the global install of gatsby because when I tried a while back there were a whole bunch of dependencies which were required and not added to the global install, AND hot reload did not work. So I switched to npx instead. Which was working well (with a hiccup or two on occasion but well overall) until yesterday. Here is the link to the repo for viewing: docscorneronline Update: Now I am getting the following in the Chrome DevTools Console: workbox-core.dev.js:132 workbox Network request for '/2b40ccbe4a28bd46ac66.hot-update.json' threw an error. TypeError: Failed to fetch |
Now, when I went into another gatsbyjs v2 project which has been successfully deployed (very recently) after updating OSX (now on version 10.14.5), I am getting the following error in the console which usually goes away on refresh, but now does NOT:
And in the terminal console, I am getting the following:
|
FYI: I found out in my case that it was a Chrome browser issue. Gatsby works in Firefox and Safari for me but not Chrome. Hope this helps others who might be having similar issues. |
I am also experiencing the same issue. Running on ubuntu 19.04 |
Mind sharing your environment by running It would also be really helpful if you can create a reproduction or share your source code. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
I had the same problem where only parts of my project were hot reloading. No error messages or warnings either. It turns out it was because the casing of the component name in my imports was not the same as the actual component folder name. |
I'm having hot reload issues with certain parts of my project as well. When i make a change to the file i get the Running on MacOS 10.14.5. |
I have issue to with HR :/ |
I ran into this issue, it was solved by creating the project in the WSL2 file structure instead of the Windows file structure. Original project that couldn't hot reload was created in C:\Users\username\Documents Project that was able to utilize hot reloading was created in \wsl$\Ubuntu\home\username (it's all under a "network device" apparently) Quick tip for this also, you can open file explorer to your current WSL2 directory by running the command "explorer.exe .". It can also be accessed easily in VS Code by installing the VS Code Remote Development plugin, found here: https://code.visualstudio.com/docs/remote/remote-overview |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
npm run develop -o |
@mtdenton's advice worked for me to enable HML, but I also had to run "code ." inside my WSL project folder. [dont forget the dot "." at the end!] |
For what it's worth, I was hitting this issue myself using a new gatsby-theme-blog starter project and resolved the issue by updating my dependencies. The starter repo had out of date dependencies when it was cloned/installed, so updating the version had the fixes I needed! |
Thanks so much!! This worked for me!! I quess for now we need to keep the websites inside ubuntu itself on wsl1/wsl2 for hot reloading to work. I had the same issue with Jekyll sites not live reloading, but now it's doing it..happy 👍 |
Solved by adding a
|
Just installed Gatsby and cloned the Hello World starter repo with Node version v10.19.0 on Mac Mojave 10.14.6. Can confirm that running 'gatsby build' and then 'gatsby develop' fixed the issue for me (for now). Much appreciated! |
This seems really wrong. Gatsby's |
WSL2 is creating issues on hot-reloading. Don't know why, but I followed this, it still doesn't work! @microsoft should look into this asap! |
Hi friends! Im running
hope it works for you ;) |
I had the same problem. What worked for me was to ;
|
For me |
Same error here. From one day to another. Seems to affect only one project of my several gatsby ones. Whats happening is: See the right EventStream Pane of the chrome dev console. My changes get noticed by HMR because i always get a new event but only sometimes the hash changes. If it does, everything is fine, but most of the time it doesnt change so i dont get an update. Some things i checked:
Quite clueless here. Update: |
I was having the same issue. I was importing components with their filename as uppercase (Dashboard via dashboard). Whilst they rendered fine hot-reload was not working. Seems like a bug as on Windows Dashboard and dashboard are the same file and should be treated as such. |
This worked for me !! We need to have a 404 page it seems, you can also see the 404 error in chrome-dev-tools console too. |
Doesn't work for me. I have a 404 page and HMR is connected. Doesn't releoad when I save my changes. What's more, is some changes I have don't get loaded at all. I applied an I am on MacOS. Here is my
|
Babel plugin presets are breaking this. Remove them. In my case it babel-preset-gatsby it uses for browserslist but was completely breaking HMR. Fresh install. |
@cigzigwon Can you please add more details on your message? How exactly did you solve the problem? |
If anyone using WSL2 reaches this thread after googling about hot reloading not working, I'd just like to leave my two cents and say that @seandearnaley 's answer really helped me. Not only it fixed my issue, but it also made the project incredibly faster. I don't know if I was wrong in storing my project on |
@dko-slapdash Ummm. Facepalm. |
OMG THANK YOU 🙏🏻 🤦🏼♂️ |
Guess what? Try using Mapbox SDK V2. I think my HMR is broken again and my guess is that it's all related to babel. Out of the box Gatsby seems to have issues with HMR when you either customize babel or avoid transpiring like with Mapbox. This sucks. |
So after spending an hour doing a yarn upgrade and patching nothing happened. So I looked a a problem page that didn't load mapbox and what I found is that I have a list of events outside of the page component which is an array of objects with a gatsby <StaticImage/ > tag in it. I just moved that list into the component and it works now! So something similar might be the issue on the mapbox page or that page is going to be an altogether different issue. |
Oh sweet! cleared the cache rebooted gatsby and mapbox page is fixed! I think this is related to the default-starter being out of date really bad. You have to patch all kindsa stuff if you actually resolve the warning then worker-loader can perform correctly but it had errors until I dumped .cache dir. |
worked for me too |
Is hot reloading working in windows with Gatsby, or I have to use Linux? |
I fixed hot refreshing by removing the following option from gatsby-config.js :
|
Commenting for future reference: I had a similar problem with an older Gatsby site that I just updated (v4 -> v5). The issue that I found was that for components which default exported the e.g. in pages/index.tsx
Change to
It's strange but seems to fix the issue. |
So I was facing the same issue while running on C drive mount in WSL2. The solution that worked was adding WATCHPACK_POLLING=TRUE to the develop script.
|
** Summary**
After developing my first hello-world using
gatsby develop
and viewing localhost:8000, I noticed that hot reloading isn't actually working for me. Changes made in VCS code are not being seen in browser, even upon reload of the page.The only way to see changes I've made in VCS code to index.js is to restart my CLI and re-run
gatsby develop
Steps I took
Command line:
gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world#v2
cd hello-world
gatsby develop (however, after this step, I get:
info ℹ 「wdm」: Compiled successfully. )
The terminal then hangs.
changed content in src/pages/index.js using VCS code.
Environment (if relevant)
System:
OS: Linux 4.4 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 12.1.0 - /home/linuxbrew/.linuxbrew/bin/node
npm: 6.9.0 - /home/linuxbrew/.linuxbrew/bin/npm
npmPackages:
gatsby: ^2.4.2 => 2.4.2
npmGlobalPackages:
gatsby-cli: 2.5.12
File contents (if changed)
The text was updated successfully, but these errors were encountered: