Ionic-app-scripts: TypeError: Cannot read property 'flags' of undefined

Created on 22 May 2018  路  6Comments  路  Source: ionic-team/ionic-app-scripts

Short description of the problem:

As I execute npm run build --prod, the following error occurs, stopping the build:

TypeError: Cannot read property 'flags' of undefined

What behavior are you expecting?

A working prod build (i.e. using AOT).

Steps to reproduce:

  1. See the attached package.json
  2. With similar dependencies, run npm run build --prod
  3. crash
insert any relevant code between the above and below backticks

Which @ionic/app-scripts version are you using?
See package.json

package.json

{
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "config": {
    "ionic_webpack": "./config/webpack.config.js"
  },
  "dependencies": {
    "@angular/animations": "^5.2.11",
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/compiler-cli": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/flex-layout": "2.0.0-beta.12",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "4.4.0",
    "@ionic/pro": "1.0.17",
    "@ionic/storage": "2.1.3",
    "@ngrx/effects": "^5.2.0",
    "@ngrx/store": "^5.2.0",
    "@ngrx/store-devtools": "^5.2.0",
    "angularfire2": "^5.0.0-rc.5-next",
    "firebase": "^4.13.1",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "ngx-perfect-scrollbar": "^5.3.5",
    "rxjs": "^6.0.0",
    "rxjs-compat": "^6.1.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.9",
    "redux-devtools-extension": "^2.13.2",
    "typescript": "~2.4.2"
  }
}

Full error stack:

[16:09:06] ionic-app-script task: "build"
[16:09:06] TypeError: Cannot read property 'flags' of undefined
TypeError: Cannot read property 'flags' of undefined
at checkUnreachable (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:24905:31)
at bindChildrenWorker (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:23111:17)
at bindChildren (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:23055:17)
at bind (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:24319:21)
at bindSourceFile (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:22689:17)
at Object.bindSourceFile (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:22640:9)
at initializeTypeChecker (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:47988:20)
at Object.createTypeChecker (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:27142:9)
at getDiagnosticsProducingTypeChecker (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:69678:93)
at emitWorker (C:\Users\e026486\Projects_jem\ionosphere\node_modules\typescript\lib\typescript.js:69722:32)

Most helpful comment

Reverting from "@ionic/app-scripts": "3.2" to "@ionic/app-scripts": "3.1.11" works fine.
Compatibility issue with webpack ?

All 6 comments

What about this issue?
I got a similar one:
[19:06:05] ionic-app-script task: "build" [19:06:05] TypeError: Cannot read property 'compilation' of undefined TypeError: Cannot read property 'compilation' of undefined at DefinePlugin.apply (C:\Applications\Node\AWS\ionic\node_modules\webpack\lib\DefinePlugin.js:93:18) at Compiler.apply (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\node_modules\tapable\lib\Tapable.js:375:16) at webpack (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\node_modules\webpack\lib\webpack.js:33:19) at C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\dist\webpack.js:132:24 at new Promise (<anonymous>) at runWebpackFullBuild (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\dist\webpack.js:113:12) at webpackWorker (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\dist\webpack.js:70:19) at Object.webpack (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\dist\webpack.js:29:12) at bundleWorker (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\dist\bundle.js:13:22) at Object.bundle (C:\Applications\Node\AWS\ionic\node_modules\@ionic\app-scripts\dist\bundle.js:6:12)

Reverting from "@ionic/app-scripts": "3.2" to "@ionic/app-scripts": "3.1.11" works fine.
Compatibility issue with webpack ?

I still get this error with3.1.11

TREHMAN-MB:assets-font-compare-tool tanzeel.rehman$ ionic build --prod 
> ionic-app-scripts build --prod
[15:55:02]  ionic-app-scripts 3.1.11 
[15:55:02]  build prod started ... 
[15:55:02]  clean started ... 
[15:55:02]  clean finished in 2 ms 
[15:55:02]  copy started ... 
[15:55:02]  deeplinks started ... 
[15:55:02]  deeplinks finished in 38 ms 
[15:55:02]  ngc started ... 
[15:55:04]  ionic-app-script task: "build" 
[15:55:04]  TypeError: Cannot read property 'flags' of undefined 
TypeError: Cannot read property 'flags' of undefined
    at checkUnreachable (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:24289:31)
    at bindChildrenWorker (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:22376:17)
    at bindChildren (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:22332:17)
    at bindContainer (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:22324:17)
    at bind (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:23595:21)
    at bindSourceFile (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:21956:17)
    at Object.bindSourceFile (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:21897:9)
    at initializeTypeChecker (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:51232:20)
    at Object.createTypeChecker (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:27069:9)
    at Object.getTypeChecker (/Users/tanzeel.rehman/Development/assets-font-compare-tool/node_modules/typescript/lib/typescript.js:79026:79)
[ERROR] An error occurred while running subprocess ionic-app-scripts.

        ionic-app-scripts build --prod exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

ionic version :

TREHMAN-MB:assets-font-compare-tool tanzeel.rehman$ ionic --version 
4.1.0

my package.json :

{
  "name": "assets-font-compare-tool",
  "version": "0.0.0",
  "config": {
    "ionic_www_dir": "./dist"
  },
  "scripts": {
    "ng": "ng",
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "lint-fix": "tslint --fix -c tslint.json 'src/**/*{.ts,.tsx}'",
    "test": "ng test --watch=false --progress=false --code-coverage",
    "test:watch": "ng test",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "^5.2.11",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^5.2.11",
    "@angular/forms": "^5.2.11",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^5.2.11",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "@ionic-native/core": "~4.12.0",
    "@ionic-native/splash-screen": "~4.12.0",
    "@ionic-native/status-bar": "~4.12.0",
    "@ionic/storage": "2.1.3",
    "core-js": "^2.5.4",
    "ionic-angular": "^3.9.2",
    "ionicons": "3.0.0",
    "ngx-json-viewer": "^2.3.1",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular/cli": "~6.2.3",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@ionic/app-scripts": "3.1.11",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "cross-var": "^1.1.0",
    "ghooks": "^2.0.2",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-firefox-launcher": "~1.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-junit-reporter": "^1.2.0",
    "karma-script-launcher": "^1.0.0",
    "mkdirp": "^0.5.1",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2",
    "webpack-bundle-analyzer": "^2.9.1"
  }
}

Downgrading to 3.1.11 from 3.2.0 fixes the TypeError: Cannot read property 'compilation' of undefined issue for me, too.

Happened here too. Any reason for this ? Had to do the downgrade.

Reverting from "@ionic/app-scripts": "3.2" to "@ionic/app-scripts": "3.1.11" works fine.
Compatibility issue with webpack ?

Downgrading from ~3.2.3 to 3.1.11 worked for me too

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janpio picture janpio  路  3Comments

barbsicle picture barbsicle  路  3Comments

isflo96 picture isflo96  路  3Comments

christofferjjohansen picture christofferjjohansen  路  3Comments

danbucholtz picture danbucholtz  路  4Comments