Build fails after update to 3.8.0

Hi everybody,

today I followed the instructions for upgrading to Ionic 3.8.0. After the upgrade, my app fails to build with the following error:

$ ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[11:06:29]  build prod started ... 
[11:06:29]  clean started ... 
[11:06:29]  clean finished in 3 ms 
[11:06:29]  copy started ... 
[11:06:29]  deeplinks started ... 
[11:06:29]  deeplinks finished in 208 ms 
[11:06:29]  ngc started ... 
Error: Metadata version mismatch for module /path/to/ionic/jzw-app-uc/node_modules/@ionic/storage/dist/src/storage.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler/bundles/compiler.umd.js:25755:34)
    at StaticSymbolResolver._createSymbolsOf (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler/bundles/compiler.umd.js:25543:46)
    at StaticSymbolResolver.getSymbolsOf (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler/bundles/compiler.umd.js:25524:14)
    at /path/to/ionic/jzw-app-uc/node_modules/@angular/compiler/bundles/compiler.umd.js:24381:30
    at Array.forEach (native)
    at extractProgramSymbols (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler/bundles/compiler.umd.js:24380:79)
    at AotCompiler.analyzeModulesAsync (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler/bundles/compiler.umd.js:23936:47)
    at CodeGenerator.codegen (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/path/to/ionic/jzw-app-uc/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
    at Object.doCodegen (/path/to/ionic/jzw-app-uc/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:51)
[11:06:32]  copy finished in 3.05 s

Here is the output of “ionic info”:

$ ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.16.0
    ionic (Ionic CLI) : 3.16.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.2.3 ios 4.4.0
    Ionic Framework    : ionic-angular 3.8.0

System:

    ios-deploy : 1.9.2 
    ios-sim    : 6.0.0 
    Node       : v6.11.4
    npm        : 5.5.1 
    OS         : OS X El Capitan
    Xcode      : Xcode 8.2.1 Build version 8C1002 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Can anybody advise what kind of problem this is?

Cheers,
Andy

Delete and install the libs again maybe?

rm -r node_modules
npm install
ionic cordova build android --prod --release

or even

rm -r node_modules
rm package-lock.json
npm install
ionic cordova build android --prod --release

We have meanwhile fixed this issue.

It was caused by the latest version of the ionic-storage plugin (2.1.1) being compiled with Angular 5 which produces Metadata files for the module incompatible with Ionic.

Solution:

Downgrade to an earlier version of ionic-storage:

npm remove @ionic/storage
npm install @ionic/storage@2.0.1
2 Likes