Ionic serve --lab defaults to Mac's IP


#1

When I run ionic serve --lab my project loads and opens fine in my browser but it uses my Mac’s IP address. I was never prompted to select either IP or localhost like I had been in previous versions. I’m ok with this but would like to know if this is expected behavior or if I have something wrong.

Environment
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.11
OS: macOS Sierra
Node Version: v6.1.0
Xcode version: Xcode 8.1 Build version 8B62

Contents of ~/.ionic/ionic.config
{
“ank”: “bf9665da-c317-4a36-9d8a-990c6b902d43”,
“accountPrompt”: “y”
}

Had to modify the default package.json scripts section to get ionic serve --lab to run without out issues.

From this:

“scripts”: {
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},

To this:

“scripts”: {
“build”: “ionic-app-scripts build”,
“watch”: “ionic-app-scripts watch”,
“serve:before”: “watch”,
“emulate:before”: “build”,
“deploy:before”: “build”,
“build:before”: “build”,
“run:before”: “build”
},

Using he default script section in the package.json file results in the following when running ionic serve --lab:
express deprecated res.sendfile: Use res.sendFile instead node_modules/@ionic/app-scripts/dist/dev-server/http-server.js:26:20

Also, if I turn my Mac’s WiFi off and run ionic serve --lab, it opens fine in my browser using localhost.

Thanks everyone
Eric


#2

Run
ionic address
in the command line. It will show available addresses to choose from . You can select localhost.
Or run ionic serve -l --address "Your_IP_Address"
Check here


#3

Hi and thank you for the response. When I run ionic address and hit enter, I do not get the expected prompted that would allow me to select and IP or localhost host. It just goes to the next line. It does nothing. I’ve used that command in the past successfully in previous versions. Does not do anything in the version (see above) I’m currently running.
Thanks


#4

Hi,
I dont think it has anything to do with version. The latest version is working fine for me (in Windows though).
I just saw your ionic.config
I have another parameter “ionicServeAddress”:local_ip
set.


#5

Thanks! Would you mind sending me the contents of your ionic info and package.json file? I suspect there is something wrong with my scripts section, although its the defaults.
Thanks
E


#6

ionic info
Your system information:

ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.8.1

package.json
"scripts": {
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”
},
“dependencies”: {
"@angular/common": “2.1.1”,
"@angular/compiler": “2.1.1”,
"@angular/compiler-cli": “2.1.1”,
"@angular/core": “2.1.1”,
"@angular/forms": “2.1.1”,
"@angular/http": “2.1.1”,
"@angular/platform-browser": “2.1.1”,
"@angular/platform-browser-dynamic": “2.1.1”,
"@angular/platform-server": “2.1.1”,
"@ionic/storage": “1.1.6”,
“ionic-angular”: “^2.0.0-rc.3”,
“ionic-native”: “^2.2.3”,
“ionicons”: “3.0.0”,
“ng2-cordova-oauth”: “0.0.6”,
“rxjs”: “5.0.0-beta.12”,
“zone.js”: “0.6.26”
},
“devDependencies”: {
"@ionic/app-scripts": “0.0.46”,
“typescript”: “2.0.6”
},

Hope it helps :slight_smile: