Reputation: 2444
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 the following for start
"start": "set HOST=127.0.0.1 && react-scripts start"
This yields following error:
Attempting to bind to HOST environment variable: 127.0.0.1
If this was unintentional, check that you haven't mistakenly set it in your shell.
Learn more here:
node:events:346
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND 127.0.0.1
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:69:26)
Emitted 'error' event on Server instance at:
at GetAddrInfoReqWrap.doListen [as callback] (node:net:1493:12)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:69:17) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: '127.0.0.1 '
I also tried updating my hosts file to have following line: localhost 127.0.0.1
Note that i can launch 127.0.0.1 in launch.json but that only applies to when i am debugging
Upvotes: 1
Views: 11352
Reputation: 2444
So finally figured this out. Created a file called .env.local
(mind the beginning .) containing following:
HOST=127.0.0.1
Upvotes: 4
Reputation: 1
For those who this answer (Maxqueue) does not work try :
worked for me !
Upvotes: 0