Description:
Server doesn't start after upgrading to the latest version of Ionic CLI (Ionic v1 project)
Steps to Reproduce:
npm install -g ionicionic start testv1 sidemenu --type=ionic1cd testv1ionic serve --verboseOutput (from the bellow steps):
$ ionic serve --verbose
ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
ionic:cli-utils CLI global options: { _: [ 'serve' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +218ms
ionic:cli-utils:lib:environment Environment open. +0ms
ionic:cli-utils:lib:project Project type from config: Ionic 1 (ionic1) +0ms
ionic:cli-utils Project name: undefined +16ms
ionic:cli Context: { binPath: 'C:\\Users\\xxxxxx\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\xxxxxx\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\dev\\projects\\mobile\\Projects\\testv1', version: '4.0.3' } +0ms
ionic:cli-utils:lib:hooks Looking for ionic:serve:before npm script. +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:8100 +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:35729 +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:53703 +0ms
ionic:cli-framework:utils:network checking for open port on xx.xx.8.170:8100 +0ms
ionic:cli-framework:utils:network checking for open port on xx.xx.8.170:35729 +0ms
ionic:cli-framework:utils:network checking for open port on xx.xx.8.170:53703 +0ms
ionic:cli-framework:utils:network checking for open port on 192.168.56.1:8100 +17ms
ionic:cli-framework:utils:network checking for open port on 192.168.56.1:35729 +1ms
ionic:cli-framework:utils:network checking for open port on 192.168.56.1:53703 +1ms
ionic:cli-framework:utils:network checking for open port on 192.168.38.2:8100 +5ms
ionic:cli-framework:utils:network checking for open port on 192.168.38.2:35729 +2ms
ionic:cli-framework:utils:network checking for open port on 192.168.38.2:53703 +1ms
ionic:cli-framework:utils:network checking for open port on ::1:8100 +6ms
ionic:cli-framework:utils:network checking for open port on ::1:35729 +1ms
ionic:cli-framework:utils:network checking for open port on ::1:53703 +1ms
ionic:cli-framework:utils:network checking for open port on 127.0.0.1:8100 +9ms
ionic:cli-framework:utils:network checking for open port on 127.0.0.1:35729 +1ms
ionic:cli-framework:utils:network checking for open port on 127.0.0.1:53703 +1ms
ionic:cli-utils:lib:serve Looking for ionic:serve npm script. +0ms
> ionic-v1 serve --host=0.0.0.0 --port=8100 --livereload-port=35729 --dev-port=53703 --engine=browser
[v1] 2018-08-02T15:15:52.145Z ionic:v1-toolkit:lib:gulp Using gulpfile: C:\dev\projects\mobile\Projects\testv1\gulpfile.js
[v1] 2018-08-02T15:15:52.147Z ionic:v1-toolkit:lib:gulp Using gulp: C:\dev\projects\mobile\Projects\testv1\node_modules\gulp\index.js
[v1] 2018-08-02T15:15:52.581Z ionic:v1-toolkit:lib:gulp Loaded gulp tasks: { default: { fn: [Function], dep: [ 'sass' ], name: 'default' }, sass: { fn: [Function], dep: [], name: 'sass' }, watch: { fn: [Function], dep: [ 'sass' ], name: 'watch' } }
[v1] [17:15:52] Serving directory www
[v1] 2018-08-02T15:15:52.664Z tinylr:server Configuring HTTP server
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "x-powered-by" to true
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "etag" to 'weak'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "etag fn" to [Function: generateETag]
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "env" to 'development'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "query parser" to 'extended'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "query parser fn" to [Function: parseExtendedQueryString]
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "subdomain offset" to 2
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "trust proxy" to false
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "trust proxy fn" to [Function: trustNone]
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application booting in development mode
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "view" to [Function: View]
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "views" to 'C:\\dev\\projects\\mobile\\Projects\\testv1\\views'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:application set "jsonp callback name" to 'callback'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router use '/' query
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:layer new '/'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router use '/' expressInit
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:layer new '/'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:route new '/'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:layer new '/'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:route get '/'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:layer new '/'
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router use '/' serveStatic
[v1] Thu, 02 Aug 2018 15:15:52 GMT express:router:layer new '/'
[v1] Thu, 02 Aug 2018 15:15:53 GMT express:router use '/__ionic/tiny-lr' middleware
[v1] Thu, 02 Aug 2018 15:15:53 GMT express:router:layer new '/__ionic/tiny-lr'
[v1] Thu, 02 Aug 2018 15:15:53 GMT express:router:route new '/__ionic/dev-server.js'
[v1] Thu, 02 Aug 2018 15:15:53 GMT express:router:layer new '/__ionic/dev-server.js'
[v1] Thu, 02 Aug 2018 15:15:53 GMT express:router:route get '/__ionic/dev-server.js'
[v1] Thu, 02 Aug 2018 15:15:53 GMT express:router:layer new '/'
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
ionic:cli-utils:lib:serve awaiting TCP connection to 0.0.0.0:8100 +2s
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:15:53 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\testv1\node_modules\snapdragon\lib\parser.js
[INFO] Waiting for connectivity with ionic-v1...
[INFO] Waiting for connectivity with ionic-v1...
[INFO] Waiting for connectivity with ionic-v1...
[INFO] Waiting for connectivity with ionic-v1...
Output (from our project):
$ ionic serve --verbose
ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
ionic:cli-utils CLI global options: { _: [ 'serve' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +218ms
ionic:cli-utils:lib:environment Environment open. +0ms
ionic:cli-utils:lib:project Project type from config: Ionic 1 (ionic1) +0ms
ionic:cli-utils Project name: undefined +16ms
ionic:cli Context: { binPath: 'C:\\Users\\xxxxx\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\xxxxx\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\dev\\projects\\mobile\\Projects\\test_cli_v4\\xxxxx', version: '4.0.3' } +0ms
ionic:cli-utils:lib:hooks Looking for ionic:serve:before npm script. +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:8100 +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:35729 +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:53703 +0ms
ionic:cli-framework:utils:network checking for open port on xx.xx.8.170:35729 +0ms
ionic:cli-framework:utils:network checking for open port on xx.xx.8.170:53703 +0ms
ionic:cli-framework:utils:network checking for open port on 0.0.0.0:8101 +0ms
ionic:cli-framework:utils:network checking for open port on 192.168.56.1:35729 +15ms
ionic:cli-framework:utils:network checking for open port on 192.168.56.1:53703 +0ms
ionic:cli-framework:utils:network checking for open port on xx.xx.8.170:8101 +0ms
ionic:cli-framework:utils:network checking for open port on 192.168.38.2:35729 +0ms
ionic:cli-framework:utils:network checking for open port on 192.168.38.2:53703 +0ms
ionic:cli-framework:utils:network checking for open port on 192.168.56.1:8101 +0ms
ionic:cli-framework:utils:network checking for open port on ::1:35729 +16ms
ionic:cli-framework:utils:network checking for open port on ::1:53703 +0ms
ionic:cli-framework:utils:network checking for open port on 192.168.38.2:8101 +0ms
ionic:cli-framework:utils:network checking for open port on 127.0.0.1:35729 +0ms
ionic:cli-framework:utils:network checking for open port on 127.0.0.1:53703 +0ms
ionic:cli-framework:utils:network checking for open port on ::1:8101 +0ms
ionic:cli-framework:utils:network checking for open port on 127.0.0.1:8101 +0ms
ionic:cli-utils:lib:project:common Port 8100 taken, using 8101. +0ms
ionic:cli-utils:lib:serve Looking for ionic:serve npm script. +0ms
> ionic-v1 serve --host=0.0.0.0 --port=8101 --livereload-port=35729 --dev-port=53703 --engine=browser
[v1] 2018-08-02T15:06:09.992Z ionic:v1-toolkit:lib:gulp Using gulpfile: C:\dev\projects\mobile\Projects\test_cli_v4\xxxxx\gulpfile.js
[v1] 2018-08-02T15:06:09.992Z ionic:v1-toolkit:lib:gulp Using gulp: C:\dev\projects\mobile\Projects\test_cli_v4\xxxxx\node_modules\gulp\index.js
[v1] 2018-08-02T15:06:11.131Z ionic:v1-toolkit:lib:gulp Loaded gulp tasks: { 'ionic:watch:before': { fn: [Function], dep: [ 'default', 'watch' ], name: 'ionic:watch:before' }, 'ionic:serve:before': { fn: [Function], dep: [ 'default', 'watch' ], name: 'ionic:serve:before' }, default: { fn: [Function], dep: [ 'img', 'fonts', 'css', 'lib', 'templateCache', 'useref', 'buildInfo' ], name: 'default' }, 'build-eslint': { fn: [Function], dep: [], name: 'build-eslint' }, img: { fn: [Function], dep: [], name: 'img' }, fonts: { fn: [Function], dep: [], name: 'fonts' }, css: { fn: [Function], dep: [], name: 'css' }, sass: { fn: [Function], dep: [ 'css' ], name: 'sass' }, lib: { fn: [Function], dep: [], name: 'lib' }, deleteUselessFiles: { fn: [Function], dep: [], name: 'deleteUselessFiles' }, templateCache: { fn: [Function], dep: [], name: 'templateCache' }, useref: { fn: [Function], dep: [], name: 'useref' }, buildInfo: { fn: [Function], dep: [], name: 'buildInfo' }, watch: { fn: [Function], dep: [], name: 'watch' }, eslint: { fn: [Function], dep: [], name: 'eslint' }, run: { fn: [Function], dep: [], name: 'run' } }
[v1] [17:06:11] Invoking ionic:serve:before gulp task.
[v1] [17:06:21] Serving directory www
[v1] 2018-08-02T15:06:21.527Z tinylr:server Configuring HTTP server
...
ionic:cli-utils:lib:serve awaiting TCP connection to 0.0.0.0:8101 +12s
...
// *LOT* of snapdragon:compiler / snapdragon:parser outputs
[v1] Thu, 02 Aug 2018 15:06:21 GMT snapdragon:compiler initializing C:\dev\projects\mobile\Projects\test_cli_v4\xxxxx\node_modules\snapdragon\lib\compiler.js
[v1] Thu, 02 Aug 2018 15:06:21 GMT snapdragon:parser initializing C:\dev\projects\mobile\Projects\test_cli_v4\xxxxx\node_modules\snapdragon\lib\parser.js
...
[INFO] Waiting for connectivity with ionic-v1...
[INFO] Waiting for connectivity with ionic-v1...
...
My ionic info:
$ ionic info
[WARN] Error with .\www\lib\ionic\version.json file: FILE_NOT_FOUND, trying .\bower.json.
Ionic:
ionic (Ionic CLI) : 4.0.3 (C:\Users\xxxxxx\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic1 1.3.4
@ionic/v1-toolkit : 1.0.0
System:
NodeJS : v8.9.4 (C:\dev\tools\nodejs\node.exe)
npm : 5.6.0
OS : Windows 7
Other Information:
package.json (from steps to reproduce)
$ cat package.json
{
"name": "testv1",
"version": "0.0.1",
"description": "An Ionic project",
"devDependencies": {
"@ionic/v1-toolkit": "^1.0.2",
"gulp": "^3.5.6",
"gulp-clean-css": "^3.7.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^3.1.0"
}
}
@ionic/v1-toolkit is v1.0.0 by default (same issue), upgrade to 1.0.2 doesn't work either.
Was this not happening in Ionic CLI 4.0.2?
Confirmed! Works as expected in 4.0.2 @dwieeb
Darn!
Thank you for testing that. It seems to be related to the changes in this PR: https://github.com/ionic-team/ionic-cli/pull/3444
@rdlabo Thoughts? net.connect({ host: '0.0.0.0' }) appears to not work on all computers
Getting similar behavior on Ionic4/Capacitor project on Windows 10.
The "ionic serve" command results in this message being repeated in the console
[INFO] Waiting for connectivity with ng...
The "ionic serve" command successfully displays app in version Ionic 4.0.2
$ ionic info
Ionic:
ionic (Ionic CLI) : 4.0.2 (C:\Users\matth\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.0
@angular-devkit/core : 0.7.0-rc.3
@angular-devkit/schematics : 0.7.0-rc.3
@angular/cli : 6.0.8
@ionic/ng-toolkit : 1.0.0
@ionic/schematics-angular : 1.0.0
System:
NodeJS : v8.9.4 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10
@dwieeb mumumu...It is a guess
localhost can used ip v4 and v6(auto resolved). But maybe, 0.0.0.0 is v4 only.if worked ionic serve --address :: or ionic serve --address ::1 only, I will develop IP v6 code.
@CheetahDev @matthew-valenti
Please try ionic serve --address 127.0.0.1 and ionic serve --address :: and ionic serve --address ::1. (this command can be success in my env). let me know if it moves
@rdlabo Maybe we should use 127.0.0.1 instead of options.address... Also the Ionic CLI is totally untested for use with IPv6. I know for certain some things will not work (but serve may be fine).
@amanitequeen If you're still around, would you mind copy/pasting the contents of the following file: C:\Windows\System32\Drivers\etc\hosts? I am looking for localhost entries, or the lack thereof.
@dwieeb It may be good to check the dns. If ionic serve --address 127.0.0.1 work well, I will insert this process.
dns.lookup(host, (error, address) => {
if (host === '0.0.0.0' && typeof address === 'undefined') {
host = '127.0.0.1';
}
Agreed, I think we'll need some sort of check just like that.
Although, @rdlabo The dns lookup shouldn't be necessary, as the NodeJS internals will do that. I think just the if-statement:
if (host === '0.0.0.0' && typeof address === 'undefined') {
host = '127.0.0.1';
}
@dwieeb
will all 0.0.0.0 change '127.0.0.1' ? If so, I think default serve host should to be --host=127.0.0.1. ( But this is big change, can not read the influence)
We are talking about the host used for the changes introduced in this PR: https://github.com/ionic-team/ionic-cli/pull/3444/files
Here is what I'm thinking:
const host = options.address === '0.0.0.0' ? '127.0.0.1' : options.address;
await isHostConnectable(host, port);
The default serve address should not be 127.0.0.1, as DevApp would stop working by default.
as DevApp would stop working by default.
Sure, I see. I will make pull request. Maybe this is change in network.ts.
Hello !
(Sorry I live in France i was actually sleeping ^^') here is the hosts file :
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# ::1 localhost
127.0.0.1 localhost prod-lw.site.com dev-lw.site.com
Hi @rdlabo,
@CheetahDev @matthew-valenti
Please try ionic serve --address 127.0.0.1 and ionic serve --address :: and ionic serve --address ::1. (this command can be success in my env). let me know if it moves
:heavy_check_mark: serve --address 127.0.0.1 works as expected
Output [INFO] Browser window opened to http://localhost:8101!
:x: ionic serve --address :: doesn't work
Output [INFO] Waiting for connectivity with ionic-v1...
:heavy_check_mark: ionic serve --address ::1 works as expected
Output [INFO] Browser window opened to http://localhost:8100!
Regards
@amanitequeen thanks! ( in Japan, Now is the evening)
and please try ionic serve --address 127.0.0.1. Maybe this is work.
@CheetahDev Sure, Ionic CLI don't use 0.0.0.0 in your env. but can use 127.0.0.1. thanks!!
@amanitequeen Thank you! Hmm, the file looks fine. Won't matter, because I think we'll be using 127.0.0.1 anyway.