I'm just starting to build an Ionic 2 app, but I can't get it working on my mobile device.
Python (works)
To demonstrate that the phone can see the host, I tried a Python server:
$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
If I go to http://192.168.8.101:8000 on my phone, it connects fine and displays the directory listing.
Node (fails)
However, when I start Ionic:
$ ionic serve -p 8000
[...]
[INFO] Development server running
Local: http://localhost:8000
External: http://192.168.8.101:8000
I can load it in my host's web browser, but I can't see it from my phone nor another computer (it times out). I also tried a basic node server:
$ npm install http-server -g
$ http-server -p 8000
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8000
http://192.168.8.101:8000
With the same result as Ionic: accessible from the host, but not from the phone.
Is there something blocking the request? Or is there some Node configuration I'm missing? I'm new to both Mac OS and Node, so I don't know where to look.
Embarrasingly, this turned out to be a firewall issue. In System Preferences > Security & Privacy > Firewall > Firewall Options, Node was explicitly set to deny incoming connections:
Changing it to Allow has fixed it. Phew!
Just execute ionic address and you'll get an IP address in your command line. Try with that ipaddress:port number from your mobile which will enable you to access your site from your phone.
Just incase if the ionic address command doesn't return anything, you need to execute the below command to point it to your ip,
ionic serve --address YOUR_IP_ADDRESS
Hope this helps!
Related
Which command do I need to use to start a simple HTTP server using "npm", the specified port to be used is port 8080. Also, I don't have to download the npm package. The only hint I got is that I can download the basic web server packet, also from there I can specify the port 8080?
Once the http server has been configured with the x-server name at port xxxx, you can start it with the command:
x-server -p xxxx
for example if my server's name is simple-http-server at port 8080:
simple-http-server -p 8080
would start it.
for the next exercice:
php -S 127.0.0.1:8080
I am also getting started on HTB.
contact me (in the next 23 hours) at this account or leave a correspondance as comment if you want to work with me to break through on HTB.
Once npm is installed, the command is simply: http-server -p 8080 (without writing 'npm' at the beginning of the line).
I am new to Gatsby, and I will be starting my first project today. I want to be able to test the site on my android phone to ensure mobile compatibility rather than using chrome dev-tools.
I have only ran a few commands so far.
1) Gatsby new site-name
2) cd site-name
3) gatsby develop --host 0.0.0.0 -p 8080
Everything compiles properly, and I can access the default Gatsby page through localhost:8080 or 192.168.1.81:8080 on the host laptop, but when i attempt to access from my android phone, it says that the server is unreachable. I am running windows 10 on my laptop, and so far Ive checked the firewall, and I've tried a few different ports as well. If someone has dealt with this issue and could help me that would be much appreciated!
I don't know why they blocked access by default :/ But you can access it by adding -H 0.0.0.0 to develop command. For example change your package.json to:
"develop": "gatsby develop -H 0.0.0.0",
you can fix this issue by using this command
gatsby develop -H 0.0.0.0
more information : from here
after you can use your pc ip address with the port number to debug gatsby site on your mobile
Example :
192.168.1.4:8000
I had to do:
gatsby develop -h 192.168.xx.xx -p 8080
Your phone and and the computer you are running from needs to be on same wifi/network. I need sometimes to reconnect my phone to the wifi to get it right. Suppose it has to do with the private ip adress the router is assigning to devices.
Then 192.168.1.xx:8000 can be opened on phone browser.
I'm trying to set up Jekyll on my Windows 10 machine, but can't connect to the website (127.0.0.1:4000) that is created by jekyll serve (or bundle exec jekyll serve). I have followed all the steps in Julian Thilo's Run Jekyll on Windows without any error messages. And when I run jekyll serve in PowerShell from my Jekyll website folder everything seems just fine:
Configuration file: C:/Users/fredr/dropbox/github/jekyll-website/_config.yml
Source: C:/Users/fredr/dropbox/github/jekyll-website
Destination: C:/Users/fredr/dropbox/github/jekyll-website/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.457 seconds.
Auto-regeneration: enabled for 'C:/Users/fredr/dropbox/github/jekyll-website'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
But when I open http://127.0.0.1:4000 (or http://localhost:4000) in my browser, the connection fails.
When I run netstat -an, the port 4000 is listed as
Proto Local Address Foreign Address State
TCP 127.0.0.1:4000 0.0.0.0:0 LISTENING
I have previously managed to set up a localhost using IIS, but that website is stopped now.
This Github issue seems related, but doesn't contain enough information for me to figure out how the problem was solved. It only says to use the "Jekyll on windows package", but I can't find any information on that.
Following in #Fredrik P's footsteps, I CD'd into the project's _site folder (this is where the home folder of the server should be) and ran a Python 3.x simple HTTP server:
D:\frida\frida-website\_site>python -m http.server 3999
Serving HTTP on 0.0.0.0 port 3999 (http://0.0.0.0:3999/) ...
Now pointing my browser to http://0.0.0.0:3999/ works like a charm.
If you need to use Python 2.x, the HTTP server command would be:
python -m SimpleHTTPServer 3999
For more information regarding SimpleHTTPServer (2.x) and http.server (3.x), see this Stack Overflow post.
Until some better solution pops up, I will just host the _site folder with IIS. Not as fancy pancy but works like a charm :)
I have an Azure vm with Ubuntu 12 and I want to make an Angular2 server with angular-cli. When I run ng serve --port 80 I just can't see the page with a browser. When I check with CURL from the vm I can see the HTML properly but I get an error when I try to see it from the internet.
The strangest thing is that anything else I try works perfectly, I also have an old node server on the vm and when I run that I can see it normally from CURL and from the internet.
Okay so apparently I needed to specify host : sudo ng serve --host 0.0.0.0 --port 80.
github.com/angular/angular-cli/issues/2375
Thanks to evilSnobu.
I am pretty new to sails module on node.js
I created a basic web-app and it launches good on
http://localhost:8081/test
but when I try to access with my machine name like
http://mymachinename:8081/test
it goes 404 page. I also tried to access from another PC in same domain and same 404 error.
I expect both requests should return 200 response.
Am I missing something?
Here is a little information and some suggestions. Here I am on MAC OS X.
First, yes it should work out of the box:
$ sails new app && cd $_ && npm install
$ sails lift --port 1338
http://127.0.0.1:1338/
http://192.168.0.5:1338/
http://mymachine.local:1338/
are all equivalent (loopback, my local IP, my local machine name respectively).
Try a port scan and see if the port you think it is running on is actually running or else already occupied.
On Mac OS X.
lsof -i :1337
Perhaps try starting on a different port:
sails lift --port 1338 (i did this for the above)
Did you install sails globally? If so, you could try uninstalling and reinstalling:
npm uninstall -g sails
npm install -g sails
If you are still having problems, they are local and very unlikely specific to SailsJS. Do usual troubleshooting for network / port related issues locally etc.
Finally, to gain access for other users to your local machine, i usually use ngrok. Ngrok exposes your localhost to the web - example:
$ npm install ngrok -g
$ ngrok http 1338
See this example usage:
In the above example, the locally running instance of sails at: localhost:1338 is now available on the Internet served at: http://840fa6c4.ngrok.io