I am using create-react-app and hosting in its default port localhost:3000 and want to access this from another device on the same net
If you are on Ubuntu, simply run
$> sudo ufw allow 3000
Then access your app using your internal ip from local network. to get your local IP run:
$> ifconfig
My react-scripts:3.4.1 is working,
from
"scripts": {
"start": "react-scripts start"
}
to ( 0.0.0.0 is not work )
"scripts": {
"start": "HOST=127.0.0.1 react-scripts start"
}
If you are on windows and the above solutions don't work, it is most probably a firewall issue. You can try looking in Allowed Applications in Control Panel, to check if node is allowed on private networks. Or looking in the Windows Defender Firewall with Advanced Security and checking the Monitoring\Firewall tab and check for Node.js.
Simply run HOST=0.0.0.0 npm run start
.
Afterwards open the url from another device on the network.
In your case, 192.168.0.5:3000
would work.
Documentation for setting HOST environment variables.