Ionic framework - command 'grunt serve' returns 'multiple addresses available' and freezes

蹲街弑〆低调 提交于 2020-01-02 04:49:05

问题


Used Yeoman ionic-generator https://github.com/diegonetto/generator-ionic

Where I ran it without sass, default plugin list and blank.

And when running grunt serve I get the following:

Multiple addresses available.

Please select which address to use by entering its number from the list below:

 1) 192.168.1.69 (en0)
 2) localhost

Address Selection:  

When I type 2 in terminal and return it just hangs there without going further or launching a browser.

I have tried also typing localhost or 'localhost' and returning, still nothing it just hangs...

I am so confused to why?

Any help on the matter would be most appreciated, thank you.


回答1:


This morning i ran in the same problem as you did. I look into the Ionic serve code (.\node_modules\ionic\lib\ionic\serve.js) and compared it with another file, i didnt found any difference. So instead using the "grunt serve" command i tried the "ionic serve" command. This script the didn't hang in the commandline so i could select an address. (in my case i selected 2 (the localhost)).

From this point it remembers the option you selected. so you can run "grunt serve" command again.

If the command "ionic serve" isn't working try to install ionic: "npm install -g ionic"




回答2:


Edit the file ionic.config in: (Mac) ~/.ionic or (Win) c:/users/username/.ionic
add: "ionicServeAddress": "localhost" to the config file

It will choose local host automatically and then "grunt serve" will not ask you for an address.
I found the solution here: https://stackoverflow.com/a/26330536/2925856




回答3:


The reason here is that Grunt Watch is running, it will block the terminal from other works so we cannot do anything when Grunt Watch is running. Maybe you can disconnect internet from the wifi and disconnect all Lan cable connect to your computer to make sure you only have one local ip address and run grunt serve. After that you can connect all these things again. Another solution is that it might need to set time out in serve.js in ionic lib to auto assign the selection for us or event remove the step of choosing Multiple IP Selection by auto assign to localhost.



来源:https://stackoverflow.com/questions/26251899/ionic-framework-command-grunt-serve-returns-multiple-addresses-available-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!