ionic-framework: App fails to build after upgrade to 3.8.0
Ionic version: [ ] 2.x [X] 3.x [ ] 4.x
I’m submitting a … [X] bug report [ ] feature request
Our App builds fine using Ionic 3.7.1, however fails to build with Ionic 3.8.0 due to dependency errors.
Steps to reproduce: ionic cordova build android --prod --release
Other information:
$ 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
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
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (2 by maintainers)
Issue is the result of ionic-storage 2.1.1 depending on Angular 5.x. Downgrading to ionic-storage 2.0.1 resolves the issue
i’m able to make a dev build. But the prod build fails with the above error
I have the same problem
ionic cordova build android --prod --releaseError: Metadata version mismatch for /node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3cli packages: (/usr/local/lib/node_modules)
global packages:
local packages:
System:
removing current ionic-storage and installing v2.0.1 worked for me.
npm remove @ionic/storagethennpm install --save @ionic/storage@2.0.1Same problem with
@ionic-native/status-barand@ionic-native/splash-screen“… found version 4, expected version 3.”This is not a problem w/dev builds, or running a debug version on a device. It is not a problem with
ionic cordova build android --release. It is only a problem with--prodbuilds.Doing an
npm updateseems to have solved the issue w/o downgrading anything. All my@ionic-nativeplugins are now at 4.5.2, andionic cordova run android --prodworks fine.While the answers above provide temp potential fixes for individual plugins, they don’t explain or solve the underlying problem. Rollbacks mean using older/broken plugins instead of code that was updated for a reason - that’s a quick fix, but not an ideal solution.
My question is WHY is ngc for
--prodbuilds expecting version 3 of various ionic-native plugins whenpackage.jsonclearly says to use version ^4? Why & where is it looking for version 3 at all? Where does ngc compiler/build production process pull its information from? How can people solve the underlying issue instead of degrading their app’s functionality one outdated plugin at a time?Thank for any insight ~
downgrading to @ionic-native to 4.3.3 was enough to make it work again for me. did not have to downgrade ionic 3.18.0 to 3.17.0. and indeed
ionic doctor checkwas suggesting the upgrade and made it not work any more 😃We just need to downgrade
Ionic Nativeto 4.3.3. I have tried to upgrade dependencies separately and fround that this problem occurs inIonic Native 4.4.0.I just tried
npm i --save -E @ionic-native/core@4.4.0, and it started to failandroid --prod builds.You can downgrade/stay at
4.3.3using (any one/all depending upon what you have updated) -And you can install other updates separately.
And downgrade TS to 2.4.x. Angular does not support newer TS versions at this moment
Remove your Ionic dependency from your devDeps. The latest CLI is not required as a dependecy anymore.
You should also be able to just run
npm install @ionic/storage@2.0.1 --save-exact.Hay @jzwcars, I have my ionic-storage downgrade, still I’m getting same issue. Any solution for same.