Issue
I try to run an IONIC
Web-App in my network, to reach the website by my smartphone.
To serve I run the following command in the root of the project:
ionic serve --address 192.168.13.27
But I get the following error message:
[08:34:24] ionic-app-scripts 1.0.0
[08:34:25] ionic-app-script task: "serve"
[08:34:25] TypeError: Cannot read property 'host' of undefined
TypeError: Cannot read property 'host' of undefined
at onReady (C:\Users\mkoch\Documents\Entwicklung\mobile.dev\node_modules\@ionic\app-scripts\dist\serve.js:61:22)
at C:\Users\mkoch\Documents\Entwicklung\mobile.dev\node_modules\@ionic\app-scripts\dist\serve.js:55:13
at process._tickCallback (internal/process/next_tick.js:103:7)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at boot strap_node.js:467:3
If I run serve
with --lab
or without anything else, it runs.
I also do some reseach on the internet, without an success.
How or where can I define the IP ADDRESS
of the IONIC SERVER
?
Solution
Using ionic serve
starts a lite-server on your local machine. This means, it uses your local IP. (localhost:8100
by default). So unless you change your local ip, the solution you're trying is (as far as I believe) not possible.
You can access your mobile application from your phone without building to it, either by using your local ip (both devices must be on the same network). To retrieve this ip (this example, Windows 10: ) click on your wifi icon, select your network -> properties -> IPv4 address.
When your mobile device is on the same wifi network, you can access it by this IP address (using your port, so f.e. 10.0.0.4:8100
)
Another solution would be to use the ionic view app which allows you to push to an ionic server and access the app from within this app.
Answered By - Ivar Reukers
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.