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

Inform user they've specified a HOST #3719

Closed
everdrone opened this issue Jan 9, 2018 · 12 comments
Closed

Inform user they've specified a HOST #3719

everdrone opened this issue Jan 9, 2018 · 12 comments

Comments

@everdrone
Copy link

OS

macOS 10.13.2

Node

node -v: 9.3.0
npm -v: 5.6.0
yarn -v: 1.3.2

output:

$ yarn start                                                                                                                                                                                       06:51:09
yarn run v1.3.2
warning ../../../package.json: No license field
$ react-scripts start
Could not find an open port at Giorgios-MacBook-Pro.
Network error message: listen EADDRNOTAVAIL 54.72.52.58

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

rebooted many times, updated node and npm, updated yarn and create-react-app,
but this only seems to works with sudo.

i also tried to reinstall node with nvm, after stumbling against many reports that suggested this was the cause of my issue.

this is probably a stupid bug, but it's driving me crazy since yesterday,
please help.

@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

Seems something network-related. Can you try on another network?

@everdrone
Copy link
Author

everdrone commented Jan 9, 2018

tried with an hotspot and reset the home router.

the error persists.

but shouldn't this work even if my machine is not connected to the internet?
the address should be pointing at 127.0.0.1 after all.

@raerpo
Copy link
Contributor

raerpo commented Jan 9, 2018

could be that something else is using the 3000 port?
if you run lsof -n -i:3000 | grep LISTEN should be empty

@everdrone
Copy link
Author

everdrone commented Jan 9, 2018

lsof -n -i:3000 | grep LISTEN returns empty

running the command after disabling the network connections returns this error:

$ yarn start 
yarn run v1.3.2
warning ../../../package.json: No license field
$ react-scripts start
Could not find an open port at Giorgios-MacBook-Pro.
Network error message: getaddrinfo ENOTFOUND Giorgios-MacBook-Pro

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

which looks pretty weird to me since the development server should start on localhost

@Timer
Copy link
Contributor

Timer commented Jan 9, 2018

You've most likely set your HOST in your .bash_profile erroneously.

Please remove this entry or unset HOST before running npm start.

sudo scutil --set HostName change-hostname-like-this

@everdrone
Copy link
Author

hmm funny thing, there is no .bash_profile, nor .bashrc on my machine

Im using fish shell

@everdrone
Copy link
Author

added set -x HOSTNAME (hostname -s) to my config.fish
now echo $HOST returns empty
and echo $HOSTNAME returns a string

everything is fine, the web server is working, i can sleep now.

thank you guys.

@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

Nice! Thanks @Timer for debugging this.

Is there any warning we could add to make this easier?

@Timer
Copy link
Contributor

Timer commented Jan 9, 2018

I think that'd be nice. We can add a message along the lines:

Attempting to bind to $HOST because it was specified.
If this was unintentional, check that you haven't mistakenly set it in your shell.
<link to docs>

This message would be cleared right after a successful bind, so it'd only be visible when you hit this error state.

@Timer Timer added this to the 1.0.x milestone Jan 9, 2018
@Timer Timer changed the title (yarn|npm) start gives EADDRNOTAVAIL Inform user they've specified a HOST Jan 9, 2018
@Timer Timer reopened this Jan 9, 2018
@iansu
Copy link
Contributor

iansu commented Jan 9, 2018

If you're looking for someone to implement this feature I'd be happy to help.

@Timer
Copy link
Contributor

Timer commented Jan 9, 2018

Feel free!

@iansu
Copy link
Contributor

iansu commented Jan 10, 2018

Turns out this was literally just a matter of checking for the environment variable and showing the warning message. No other changes required. 😀

@gaearon gaearon modified the milestones: 1.0.x, 2.0.x, 2.x Jan 14, 2018
Timer pushed a commit that referenced this issue Jan 14, 2018
* Add warning when HOST environment variable is set (#3719)

* Improve HOST environment variable warning message

* Adjust text and message

Closes #3719
Pavek pushed a commit to Pavek/create-react-app that referenced this issue Jul 10, 2018
* Add warning when HOST environment variable is set (facebook#3719)

* Improve HOST environment variable warning message

* Adjust text and message

Closes facebook#3719
zmitry pushed a commit to zmitry/create-react-app that referenced this issue Aug 14, 2018
* Add warning when HOST environment variable is set (facebook#3719)

* Improve HOST environment variable warning message

* Adjust text and message

Closes facebook#3719
@Timer Timer modified the milestones: 2.x, 2.0.0 Oct 1, 2018
@lock lock bot locked and limited conversation to collaborators Jan 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants