Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cordova ionic serve在本地主机而不是服务器IP上启动_Cordova_Ionic Framework_Ionic - Fatal编程技术网

Cordova ionic serve在本地主机而不是服务器IP上启动

Cordova ionic serve在本地主机而不是服务器IP上启动,cordova,ionic-framework,ionic,Cordova,Ionic Framework,Ionic,运行ionic serve时,我看到: Gulp startup tasks: [ 'sass', 'watch' ] Running dev server: http://localhost:8100 Running live reload server: http://localhost:35729 Watching : [ 'www/**/*', '!www/lib/**/*' ] Ionic server commands, enter: restart or

运行ionic serve时,我看到:

  Gulp startup tasks: [ 'sass', 'watch' ]
  Running dev server: http://localhost:8100
  Running live reload server: http://localhost:35729
  Watching : [ 'www/**/*', '!www/lib/**/*' ]
  Ionic server commands, enter:
    restart or r to restart the client app from the root
    goto or g and a url to have the app navigate to the given url
    consolelogs or c to enable/disable console log output
    serverlogs or s to enable/disable server log output
    quit or q to shutdown the server and exit
这意味着我无法从浏览器访问应用程序,因为它只能侦听localhost。如何将localhost更改为实际的服务器IP


谢谢

爱奥尼亚地址
提供了地址列表。选择其中一个。例如:

Multiple addresses available.
Please select which address to use by entering its number from the list below:
 1) 10.0.0.9 (wlan0)
 2) 172.16.58.1 (vmnet1)
 3) 172.16.16.1 (vmnet8)
 4) localhost
Std in before prompt
Address Selection:

新答案:

对于较新版本的爱奥尼亚,此地址已更改为
--地址


  • ionic address
    命令提供选择IP地址的选项。您可以从中选择一个

  • 您可以这样明确定义IP地址和端口:

    爱奥尼亚服务——地址——端口//默认为8100

    示例1:
    爱奥尼亚服务--地址本地主机--端口8101

    示例2:
    ionic-serve——地址localhost——端口8101

  • 请尝试--lab选项以同时查看多个平台

    爱奥尼亚服务——地址本地主机——实验室

Clikc to

旧答案:

使用
-地址localhost

要在多种屏幕大小和平台类型上测试应用程序,请使用--lab


非常感谢,我不知道我怎么会错过:)哇,我从
爱奥尼亚地址
中没有得到任何输出,所以我使用了
爱奥尼亚服务-地址xx.xx.xx
(127.0.0.1/localhost是我想要的)我正在尝试,但运气不好。我想爱奥尼亚已经把这个命令改成了别的命令。@Tanzeel谢谢你指出这个,它已经在更新的版本中更新了,我刚刚相应地更新了答案,希望这会有所帮助。谢谢
ionic serve -address localhost
ionic serve --lab -address localhost