Skip to content
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

run Gatsby through WSL2 #15163

Closed
NickyMeuleman opened this issue Jun 26, 2019 · 13 comments
Closed

run Gatsby through WSL2 #15163

NickyMeuleman opened this issue Jun 26, 2019 · 13 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@NickyMeuleman
Copy link
Contributor

NickyMeuleman commented Jun 26, 2019

Had trouble running gatsby develop through WSL2 (Windows subsystem for Linux v2)

context

WSL2 is available, it is still in the early stages.
https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-in-windows-insiders/
https://docs.microsoft.com/en-us/windows/wsl/wsl2-ux-changes

Steps to reproduce

Run gatsby develop from WSL2.

Actual result

Browser reports connection refused

(Temporary) solution

  1. Get the correct ip address by running
ip addr | grep eth0

and copying the ip after inet

  1. Start the Gatsby development server with
gatsby develop -H 0.0.0.0
  1. Open browser on the ip from step 1 at the port reported by gatsby develop (8000)

Thanks to @lannonbr on the Gatsby discord for the solution!

The WSL2 team will probably change how connecting to localhost works in the future, so this solution should be temporary.

@lannonbr
Copy link
Contributor

So for now my suggestion was to expose it out to the network with -H 0.0.0.0. It works, but I am not sure if this is the perfect solution. This may be good to add to the docs under the Gatsby on Windows page.

@lannonbr lannonbr added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Jun 26, 2019
@gatsbot
Copy link

gatsbot bot commented Jul 17, 2019

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! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jul 17, 2019
@lannonbr lannonbr added not stale and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Jul 22, 2019
@wardpeet
Copy link
Contributor

I'm marking this stale. If people aren't running into this too often, this isn't a pressing issue. We can deal with it again when it pops up a bit more or when wsl2 becomes mainstream.

@wardpeet wardpeet reopened this Jul 23, 2019
@lannonbr
Copy link
Contributor

I think this has been updated in a newer insiders release of WSL 2 as discussed here: https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-insiders-preview-build-18945/

@NickyMeuleman, can you possibly download this new version and verify that this issue has been resolved?

@NickyMeuleman
Copy link
Contributor Author

NickyMeuleman commented Jul 26, 2019

Ooh, that sounds very exciting!
will report back :) thanks for the heads up.

Edit: been playing around with this, and it doesn't seem to work across the board.
While things like create-react-app works, Gatsby does not.

When connecting I get the connection refused error again.

(pinging @lannonbr, since I edited this reply)

@wardpeet
Copy link
Contributor

I'm unsure this is something we can address as of now. WSL 2 is still in beta and might be a windows issue rather than a gatsby issue.

@lannonbr
Copy link
Contributor

Alright yeah that's fine. Thanks anyway for the testing @NickyMeuleman

@lannonbr
Copy link
Contributor

I will close this now and keep it on file so if this issue persists when WSL2 is stable this fall, then we can look into it.

@Nasto
Copy link

Nasto commented Jun 2, 2020

@wardpeet @lannonbr
I just installed the 2004 update for windows 10 which officially brings WSL2 with it. The issue still seems to persist under WSL2 and I'm happy to help understand and debug it. Exposing to the network using -H 0.0.0.0 also still works.

@lannonbr
Copy link
Contributor

lannonbr commented Jun 2, 2020

Alright, reopening the issue

@lannonbr lannonbr reopened this Jun 2, 2020
@github-actions
Copy link

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/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jun 23, 2020
@github-actions
Copy link

github-actions bot commented Jul 3, 2020

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 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
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! 💪💜

@github-actions github-actions bot closed this as completed Jul 3, 2020
@alago1
Copy link

alago1 commented Oct 15, 2020

I'm having trouble running gatsby develop -H 0.0.0.0 --https on WSL2

This is purely a guess but from what I've read of the documentation on the topic, devcert is adding the certificate on the wsl side of things which means that when opening the site through a browser (on the windows side) the server is just refusing to connect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

No branches or pull requests

5 participants