Erich Purpur
Erich Purpur

Reputation: 1509

React using wrong IP address for localhost

I'm trying to run the most basic react app possible and run it locally. I have referred to the startup docs: https://reactjs.org/docs/create-a-new-react-app.html

I run the app using both npm start from the docs and yarn start as indicated in the terminal. The result in the terminal looks like this:

enter image description here

My app appears to be running, but the IP address looks wrong. When I copy and paste this into my browser's address bar or try localhost:3000, my page does not load.

Other solutions I tried after referencing other StackOverflow threads:

None of those worked. What can I do to fix this?

Upvotes: 0

Views: 1230

Answers (1)

Erich Purpur
Erich Purpur

Reputation: 1509

I ran the command unset HOST in the terminal just before starting up my app and this worked.

Also, several other threads have referenced this article: https://choy.medium.com/fixing-create-react-app-when-npm-fails-to-start-because-your-host-environment-variable-is-being-4c8a9fa0b461

To set your localhost in .bash_profile do the following in the terminal...

Open bash profile in nano nano .bash_profile

type HOST="localhost" and save this file

back in the terminal, type source .bash_profile

Upvotes: 1

Related Questions