Running Reactive Native Project giving 404 not found - react-native

Running react-native sample project gives me a
404 Not Found. The Server could not locate the resource you request.

This can also happen if you've got an existing service running on port 8081, since that's the port that the packager runs on.

OPTION 1
Load from development server. Start the server from the repository root:
$ npm start
To run on device, change localhost to the IP address of your computer, and make sure your computer and iOS device are on the same Wi-Fi network.
just like this:
jsCodeLocation = [NSURL URLWithString:#"http://192.168.8.190:8081/Examples/2048/Game2048.includeRequire.runModule.bundle"];

To expand on Colin Ramsay's answer, you can check if a service is running on port 8081 by running the following command on OSX:
lsof -i :8081
If anything is running, something like his will show:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 918 Robert 6u IPv4 0x5c8c06c2a2e769cf 0t0 TCP *:sunproxyadmin (LISTEN)
nginx 1010 Robert 6u IPv4 0x5c8c06c2a2e769cf 0t0 TCP *:sunproxyadmin (LISTEN)
You can then use the PID to kill that service:
kill -9 918

Related

Address already in use for puma-dev

Problem
Whenever I try to run
bundle exec puma -C config/puma.rb --port 5000
I keep getting
bundler: failed to load command: puma (/Users/ogirginc/.asdf/installs/ruby/2.7.2/bin/puma)
Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 5000
Tried Things
I have tried anything I can think of or read. Here is the list:
1. Good old restart the mac.
Nope.
2. Find PID and kill.
Run lsof -wni tcp:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc 20u IPv4 0x1deaf49fde14659 0t0 TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc 21u IPv6 0x1deaf49ec4c9741 0t0 TCP *:commplex-main (LISTEN)
Kill with sudo kill -9 6071.
When I kill it, it is restarted with a new PID.
> lsof -wni tcp:5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ControlCe 6071 ogirginc 20u IPv4 0x1deaf49fde14659 0t0 TCP *:commplex-main (LISTEN)
ControlCe 6071 ogirginc 21u IPv6 0x1deaf49ec4c9741 0t0 TCP *:commplex-main (LISTEN)
3. Use HTOP to find & kill
Filter with puma.
Found a match.
PID USER PRI NI VIRT RES S CPU% MEM% TIME+ Command
661 ogirginc 17 0 390G 6704 ? 0.0 0.0 0:00.00 /opt/homebrew/bin/puma-dev -launchd -dir ~/.puma-dev -d localhost -timeout 15m0s -no-serve-public-paths
Kill it with sudo kill -9 661.
Restarted with a new PID.
Additional Info
rails version is 5.2.6.
puma version is 4.3.8.
puma-dev version is 0.16.2.
Here are the logs for puma-dev:
2021/10/26 09:48:14 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/ogirginc/.puma-dev
* Domains: localhost
* DNS Server port: 9253
* HTTP Server port: inherited from launchd
* HTTPS Server port: inherited from launchd
! Puma dev running...
It feels like I am missing something obvious. Probably, due to lack of understanding some critical & lower parts of puma-dev. I would really appreciate, if this is solved with some simple explanation. Thanks in advance! :)
Why
Well, this is interesting. I did not think of searching for lsof's COMMAND column, before.
Turns out, ControlCe means "Control Center" and beginning with Monterey, macOS does listen ports 5000 & 7000 on default.
Solution
Go to System Preferences > Sharing
Uncheck AirPlay Receiver.
Now, you should be able to restart puma as usual.
Source: https://developer.apple.com/forums/thread/682332

SSH Remote Tunnel port

I have 3 computers 2 Linux and 1 Windows.
Windows PC and Linux server (A) are on the same network (1).
The linux server (B) is on another network (2).
I want to make an SSH tunnel between the 2 linux servers to allow the Windows PC to access an HTTP page of the Linux server (B), which is therefore on another network.
With this command on the linux server (A) the tunnel works fine but only locally in linux.
ssh -R 8080:localhost:80 linuxa.internet.com
But from Windows PC I cannot access port 8080 on linux (A). http://linuxa.local:8080 does not work.
So I tried these two commands to open access to my PC but it doesn't work either.
ssh -R 0.0.0.0:8080:localhost:80 linuxa.internet.com
ssh -R ipwindows:8080:localhost:80 linuxa.internet.com
Can you help me ?
Thank you
From a comment, I conclude that you might have problem with the firewall. Suppose you can reach the tunnel from the host that is "proxy" (with curl,wget,ncat etc. on localhost). You should check what block traffic. In most cases, it is a firewall. Depending on your Linux distro you might have different backends and frontends for a firewall. If you have firewall-cmd command installed it's very likely that firewalld is one.
But before blaming the firewall, you should check if a port is open/closed. I prefer netcat:
HOST_THAT_SHOULD_HAVE_OPEN_PORT # nc -l 8080
HOST_THAT_SHOULD_BE_ABLE_TO_CONNECT # nc HOST_THAT_SHOULD_HAVE_OPEN_PORT 8080
If there is no connection or connection is refused, it's extremely likely that the firewall is the problem.
You can check if firewalld is running with systemctl:
# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-02-08 21:42:29 CET; 13h ago
Then you might add traffic on port 8080:
# firewall-cmd --add-port 8080/tcp
success
It will temporarily open network traffic on 8080. Then you should be able to use port 8080 and your ssh tunnel.
Thank you for your answer but I don't think I have a firewall installed
systemctl status firewalld
return
Unit firewalld.service could not be found.
and
firewall-cmd --add-port 8080/tcp
-bash: firewall-cmd: command not found

XAMPP 7.2.8-0 Mac Apache web server update/install won't start anymore

I am running MacOS Sierra Version 10.12.6 and I have just tried to upgrade to the latest version of XAMPP on localhost.
I have just upgraded from XAMPP 7.1.10 to 7.2.8-0 by performing an install of the xampp-osx-7.2.8-0-installer.dmg file.
It appears now that I am getting a conflict between AVAST running on port 80
The system was working before running both AVAST and XAMPP 7.1.10 I assume on the default port of 80 but I did not check before the upgrade to 7.2.8
Disabling the AVAST Shields still resulted in processes on port 80
colins-iMac:phpmyadmin colinhart$ sudo lsof -i :80
Password:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.avast 29044 root 46u IPv4 0xf605aed3cc5db167 0t0 TCP colins-imac:61319->host213-123-242-66.in-addr.btopenworld.com:http (ESTABLISHED)
com.avast 29044 root 57u IPv4 0xf605aed3d4de9a5f 0t0 TCP colins-imac:61274->64.95.190.66:http (ESTA
and XAMPP also running on Port 80 by default, I have tried changing the port for XAMPP to an available one 80+ to no avail
I am desperate to get this working now as I am unable to develop, so any help would be much appreciated.
I will continue trying to fix the problem by reviewing answers to similar queries.
UPDATE I uninstalled AVAST and installed AVIRA, and yet the Apache Web server still stops soon after Starting
Thanks
Colin
The resolution to the problem having tried virtually all suggestions given by previous answers on this site, was to change the /etc/hosts file as suggested in this response
Unable to start XAMPP Apache server on MacOS-Sierra
To solve this :
Executed following command
sudo -e /etc/hosts
Then, changed following entries
127.0.0.1 localhost
::1 localhost
to
127.0.0.1 localhost MacBook-Pro.local
::1 localhost MacBook-Pro.local
where MacBook-Pro.local is the name returned by hostname command in terminal session
colins-iMac:~ colinhart$ hostname
colins-iMac
colins-iMac:~ colinhart$
in my case the name should be colins-iMac
Many Thanks
Colin
Deleting the lib folder from XAMPP files and reinstalling worked for me
Check this SOF answer

Apache configured to listen on port 80 only but instead listening on port 8080 as well

I was not able to use port 8080 because it was apparently already used.
In order to see which program was using it, I typed the following command in my terminal (on MacOS):
sudo lsof -n -i :8080
Here's the result:
httpd is also listening on port 80, which I found out by using the following command:
sudo lsof -n -i :80 | grep LISTEN
Here's the result:
So I went to find out what this "httpd"-process was. Apparently it is basically the web server installed on my machine. The web server installed on my machine is Apache2.
Given this fact I concluded that Apache2 was apparently configured to listen on port 80 AND on port 8080.
BUT: Here's the crazy thing: I went to the folder /etc/apache2 and opened the file "httpd.conf". In the file Apache is configured to listen on port 80 only !!!
Why the hell is it also listening on port 8080 ?!
How can I make it listen on port 80 only ?

'ubd' Process interfering with MAMP at port 80 [duplicate]

This question already has answers here:
How do I find out how macPorts stole my port:80?
(6 answers)
Closed 3 years ago.
A few days ago my Apache server stopped 'starting'. Does anyone know about this problem.
I believe it is happening now because I, stupidly, moved a file called index.php into the htdocs/ folder.
I run lsof -i | grep LISTEN to get:
mysqld 297 waltercarvalho 10u IPv4 0xc942753e30142a85 0t0 TCP *:mysql (LISTEN)
ubd 611 waltercarvalho 18u IPv4 0xc942753e310c9f35 0t0 TCP *:49228 (LISTEN)
ubd 611 waltercarvalho 19u IPv6 0xc942753e2d7a5635 0t0 TCP *:49228 (LISTEN)
Dropbox 720 waltercarvalho 18u IPv4 0xc942753e310c90c5 0t0 TCP *:17500 (LISTEN)
Dropbox 720 waltercarvalho 25u IPv4 0xc942753e31c584dd 0t0 TCP localhost:26164 (LISTEN)
When I try to start the Apache server on port 80, in order to access localhost (the clean way), I get:
I run sudo /Applications/MAMP/bin/startApache.sh to get:
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Which means port 80 is being used. You can find my httpd.conf file at:
http://pastebin.com/dta3hND8
I have been trying to fix this for a few hours now, extremely frustrating. I have tried everything.
Thank you.
i've been struggling with this issue.. fairly certain it's dropbox that's interfering. i found a solution that works like a charm, albeit not a perm fix. i run the sequence fairly often. it's an annoyance, but at least these steps are clear, simple, and predictable! ..AND i get my 80/3306 back.
fix courtesy of Abhinav Sood.
Launch MAMP. Open Terminal by typing terminal into Spotlight (Command + Space).
Open MAMP Preferences (Command + , ) and click on Reset MAMP Ports
(Port 8888 and Port 8889 for Apache and MySQL respectively).
Click on OK.
Switch to the terminal. Type sudo apachectl stop to shutdown the system Apache.
Restart MAMP.
Open MAMP Preferences once again and click on Set to Default Apache and MySQL ports. This will set the Apache and MySQL ports to 80 and 3306 respectively.
Switch to the terminal. Type sudo apachectl restart to restart Apache.
Switch back to MAMP and click on Open Start Page (or go to http://localhost/MAMP/?language=English in your browser)
And you’re done.