'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 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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
