ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 654 forks source link

[Ionic v4] ionic build --prod timeout #3390

Open marcelgoya opened 6 years ago

marcelgoya commented 6 years ago

Description: I'm getting a timeout every time I try to compile the app with the prod flag. The node daemon seems to be sleeping as well since there's no cpu usage.

Steps to Reproduce: Run ionic build --prod --engine browser or ionic cordova build android --prod

Output:

 ionic build --prod --engine browser --verbose
  ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
  ionic:cli-utils CLI global options: { _: [ 'build' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, prod: true, engine: 'browser', project: null, '--': [] } +153ms
  ionic:cli-utils:lib:environment Environment open. +0ms
  ionic:cli-utils:lib:project Project type from config: ionic/angular 4 (angular) +0ms
  ionic:cli-utils Project name: undefined +10ms
  ionic:cli Context: { binPath: '/usr/lib/node_modules/ionic/bin/ionic', libPath: '/usr/lib/node_modules/ionic', execPath: '/mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4', version: '4.0.0' } +0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:project:angular:build Looking for ionic:build npm script. +0ms
> ng run app:build:production
Wed, 25 Jul 2018 18:34:12 GMT snapdragon:compiler initializing /mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4/node_modules/snapdragon/lib/compiler.js
Wed, 25 Jul 2018 18:34:12 GMT snapdragon:parser initializing /mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4/node_modules/snapdragon/lib/parser.js
Wed, 25 Jul 2018 18:34:12 GMT snapdragon:compiler initializing /mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4/node_modules/snapdragon/lib/compiler.js
Wed, 25 Jul 2018 18:34:12 GMT snapdragon:parser initializing /mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4/node_modules/snapdragon/lib/parser.js
Wed, 25 Jul 2018 18:34:12 GMT snapdragon:compiler initializing /mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4/node_modules/snapdragon/lib/compiler.js
Wed, 25 Jul 2018 18:34:12 GMT snapdragon:parser initializing /mnt/c/Users/marce/Documents/Code/xCode/lingusocial-ionic-v4/node_modules/snapdragon/lib/parser.js

My ionic info:


Ionic:

   ionic (Ionic CLI)          : 4.0.0 (/usr/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.0
   @angular-devkit/core       : 0.7.0-rc.2
   @angular-devkit/schematics : 0.7.0-rc.2
   @angular/cli               : 6.0.8
   @ionic/ng-toolkit          : 1.0.0
   @ionic/schematics-angular  : 1.0.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : none

System:

   NodeJS : v9.11.2 (/usr/bin/node)
   npm    : 6.2.0
   OS     : Linux 4.4

Environment:

   ANDROID_HOME : not set

Other Information:

imhoffd commented 6 years ago

What is logging those snapdragon:compiler/snapdragon:parser statements? I've never seen that before.

kinggolf commented 6 years ago

Production build working for me: ionic cordova build android --device --prod --aot and ionic cordova run android --device --prod --aot Both OK.

Ionic:

ionic (Ionic CLI) : 4.0.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.0.0-beta.0 @angular-devkit/core : 0.7.0-rc.1 @angular-devkit/schematics : 0.7.0-rc.1 @angular/cli : 6.0.8 @ionic/ng-toolkit : 1.0.0 @ionic/schematics-angular : 1.0.0

Cordova:

cordova (Cordova CLI) : 8.0.0 Cordova Platforms : android 7.0.0, ios 4.5.4

System:

Android SDK Tools : 26.1.1 ios-deploy : 1.9.2 NodeJS : v8.11.1 (/usr/local/bin/node) npm : 6.2.0 OS : macOS High Sierra Xcode : Xcode 9.4.1 Build version 9F2000

Environment:

ANDROID_HOME : /Users/golftocs/Library/Android/sdk

marcelgoya commented 6 years ago

@dwieeb Alright, I did some thorough inspection and basically what happens is that the script creates around a dozen node sub-processes and all of them go into some sort of sleep mode after around 30 seconds. I've also tried compiling under windows and it works fine there. I've also tested one of the app starter templates and the problem exists there as well, so it's not something code related. Btw, I'm running Ubuntu on Windows, so I don't know if this problem occurs on vanilla linux as well.

CheetahDev commented 6 years ago

What is logging those snapdragon:compiler/snapdragon:parser statements? I've never seen that before.

I'm interested in your remark! I have the same statements (hundreds of them) when I start my app since Ionic CLI v4

imhoffd commented 6 years ago

@CheetahDev I've found it's normal for Ionic 1 apps since we turned on verbose logging. (But not Ionic 4)

CheetahDev commented 6 years ago

Thanks for the quick reply @dwieeb It has however a side effet: we have a eslint task checking our code in real time. Verbose logging causes here tons of outputs (it outputs eslint relative stuff for minutes until we shutdown the process).

Will try to record this.

CheetahDev commented 6 years ago

@dwieeb here it is https://imgur.com/a/8O0rcys

Runing the same command without --verbose starts the app without issue. But with the verbose flag it is impossible.

imhoffd commented 6 years ago

--verbose will set the DEBUG environment variable to *, so subprocesses like eslint also have verbose logging (because most things use this module: https://www.npmjs.com/package/debug)

Maybe instead, use DEBUG="ionic:*" ionic serve

But anyway, please create a new issue! We're hijacking this one.

imhoffd commented 6 years ago

@marcelgoya Any updates?