I am unable to fetch data from JSON server using the fetch method even I am using the IP address in URL (http://192.168.1.121:3001/).
Its showing error "Network request failed" when I am trying to fetch using react native app but I can access the server using "http://localhost:3001/" in my browser.
I searched a lot on google, everyone is saying use an IP address instead of localhost, I tried this too but still no response from the server.
Please help me to sort it out it would be great for me.
Thankx!
I solved it out by starting my server by providing IP to it...
json-server --watch db.json -p 3001 -d 2000 --host 192.168.1.121
Are you using the IP Address of your PC? it has to be the IP Address from your Pc where you are developing your App - if you are running it on an Emulator. Check your Network Config on your PC and take the IPV4 Address and try that.
Related
I am using android emulator and when i send request to localhost it gives me error. I have tried the forwarding the port also ngrok but none of them worked for me. It always gives me error.
[Error:Network Error].
IN Emulator go to setting->click on Network and Internet ->then select Internet->select available network and then re-run your project and check it will work
Please try http://10.0.2.2:8080 instead of localhost:8080. If you are referring your localhost on your system from the Android emulator then you have to use http://10.0.2.2:8080/ Because Android emulator runs in a Virtual Machine therefore here 127.0.0.1 or localhost will be emulator's own loopback address.
Original Answer Source
This is my first time making react project.
After I run my project with npm run start, I can connect to it via localhost:3000 and 127.0.0.1:3000 without any problem.
But when I try to connect it with my LAN address on the same computer it shows
Could Not Connect
Description: Could not connect to the requested server host.
It also shown an error on browser console.
Failed to load resource: the server responded with a status of 502 (internal error - server connection terminated)
This same project can be open via ip4 if I run it on my laptop. I can even open it from my mobile in the same wifi.
My computer is own by company so I think something might block it.
Please give me your suggestions on how to fix this problem. What could possibly cause this problem.
Any insight would be helpful.
Thank you.
Run HOST=0.0.0.0 npm run start
Check your IP. <your-ip>:3000 would work.
https://create-react-app.dev/docs/advanced-configuration/ for setting HOST environment variables.
I'm SSHing into a linux shell for a school project. Right now, we're trying to set up a react app for a web frontend. We were able to run the app on localhost easily enough, and all of the functionality seems to be good, but I can't figure out how to get this hosted on the public IP of the computer. We've been using yarn to do all of this, though i've tried other things, so here's some cli output.
path/to/thing# yarn start
yarn run v1.22.5
$ react-scripts start
Attempting to bind to HOST environment variable: public.facing.ip.address //This is a website name
If this was unintentional, check that you haven't mistakenly set it in your shell.
Learn more here: //There was a link here but SO formatting wouln't let me keep it.
Could not find an open port at public.facing.ip.address.
Network error message: listen EADDRNOTAVAIL: address not available public.facing.ip.address //numeric
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
root#computer:path/to/thing#
When I run hostname -I, public.facing.ip.address does not appear at all. So that seems like the obvious issue. The catch here is that we are also running jenkins on a separate port of public.facing.ip.address from this same computer. That was much easier to set up, it just came as something I could start as a service using 'systemctl start jenkins' and up it went onto the public facing IP. I set all that up and I can access it just fine, etc. The best I can do with this is modify the HOST variable either in the terminal or the .env file, then yarn starts a development server on localhost (which I can't access since I'm on a different network SSHing into this computer)
How do I make yarn host our webapp on the public facing IP?
open your router page, there should be dmz host option somewhere, point it to your local ip address
My networking inexperience was the culprit. Instead of using HOST=path.to.public.ip, the solution was to use HOST=0.0.0.0.
Installing MOODLE_33_STABLE origin/MOODLE_33_STABLE on Ubuntu 16.04.2
I am able to install it and , access it with my vm's ip,
but when i try to change
$CFG->wwwroot = 'http://ipaddress'
to
$CFG->wwwroot = 'http://somerandomname.com'
in config.php,
i am unable to access it using somerandomname.com in my lan.
i have also mapped the vm ip in hosts file of both apache2 and of the other systems in lan, still it shows HTTP ERROR 502, in chrome.
and Host not found when i check the chrome console.
if i am missing something guide me.
i want to access the moodle installed on my VM across my local connection with some domainname rather than the IP .
Thank you.
Sounds like you have to try classical debugging:
Try to access your moodle instance on the specific port, using eg. telnet
telnet somerandomname.com 80
Delete browser cache or open the URL in your incognito mode
Check the apache error log on Ubuntu: /var/log/apache2/error.log.
Check out further possibilities which are causing this 502 error:
https://www.lifewire.com/502-bad-gateway-error-explained-2622939
I am relatively new to node.js and super new to Ionic and am super confused. As I was looking online for answers, I came across one blog which would say that I have to runnodejs server using node (in my case) nam start and the app using ionic serve, so lets say I am listening on port 3000, it wouldn't be http://localhost:3000 but something like http://123.456.789.123:3000
I assume that both must listen on the same port?! so if my node.js is listening on port 3000, my ionic must listen on 3000 too?
Running live reload server: http://localhost:35729
Running dev server: http://localhost:8100
I don't understand what http://localhost:35729 means - is it correct to say that Im listening on port 8100
I tried to set my node.js server to listen on port 8100 (probably all wrong what I did) and it doesn't work- can't see anything when I type ip address::8100
Thank you!!