npm start use hostname instead of localhost on Linux
See original GitHub issueMy laptop uses openSUSE Linux with hostname “Guos-Kudu”. When I created a react app and run npm start
, it opens http://guos-kudu:3000 in browser. When I visit http://localhost:3000 it cannot be accessed.
Some HTTP API only allows localhost to access. Or the API administrator only enabled localhost in OAuth configuration. In this situation, a non-standard URL will have many troubles.
Even when I changed the hostname to localhost
or remove it, react-scripts still looks for http://guos-kudu:3000 instead of localhost. Have no idea what caused this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
React npm start 127.0.0.1 instead of localhost on windows
So i am trying to launch my react application using 127.0.0.1 instead of localhost. Here is what i tried: in scripts i put...
Read more >NodeJS/ReactJS: Change HOST AND Port Number
If you need the app to run on some port, assign an environment variable named PORT to the desired port number. Here, the...
Read more >NPM Run Serve is not defaulting to localhost - Vue Forum
I have been working on a project for about 3 weeks and npm run serve would always serve up App running at: -...
Read more >Vue CLI: Using a custom domain | Web Development Blog
Vue CLI defaults to a localhost URL. This quick change allows a custom domain to be used instead. ... npm run serve. The...
Read more >webpack-dev-server - npm
Start using webpack-dev-server in your project by running `npm i ... Tells clients connected to devServer to use the provided hostname.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
HOST
variable is probably set in your env. Try to unset it in your terminal session.If that works, create a
.env.local
file which contains the following:You can now run
npm start
without worrying about unsettingHOST
.To achieve the default CRA behavior, use
0.0.0.0
instead oflocalhost
.You might want to check your
~/.bashrc
or similar (~/.profile
,~/.bash_profile
,~/.bash_profile
,~/.login
, etc).