@ionic-native/file-transfer/index.d.ts, found version 4, expected 3

Hello,
While runnig inoic cordova run android --prod I got this error.

Running app-scripts build: --prod --platform android --target cordova
[11:31:00]  build prod started ... 
[11:31:00]  clean started ... 
[11:31:00]  clean finished in 4 ms 
[11:31:00]  copy started ... 
[11:31:00]  ngc started ... 
Error: Metadata version mismatch for module /home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@ionic-native/file-transfer/index.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler/bundles/compiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler/bundles/compiler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler/bundles/compiler.umd.js:24241:14)
    at /home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler/bundles/compiler.umd.js:23023:30
    at Array.forEach (native)
    at extractProgramSymbols (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler/bundles/compiler.umd.js:23022:79)
    at AotCompiler.compileAll (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler/bundles/compiler.umd.js:22720:47)
    at CodeGenerator.codegen (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler-cli/src/codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@angular/compiler-cli/src/ngtools_api.js:61:30)
    at Object.doCodegen (/home/bbdangar/public_html/mik_lab/real-estate-app-io/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:51)
[11:31:03]  copy finished in 2.72 s 

2 Likes

Ionic Info

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

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 2.0.1
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.5.0

System:

    Node : v8.2.1
    npm  : 5.4.2 
    OS   : Linux 3.19

Environment Variables:

    ANDROID_HOME : {PATH}:/home/bbdangar/Android/Sdk

Misc:

    backend : legacy

Same issue for me on upgrading to ionic-native 4.4.0

I thinks this is because there is a incompatibility between angular4 and angular5 which now is using ionic-native 4.4.0

@mburger81 I have recently upgraded Ionic cli to 3.18.0. should I downgrade to work normally??

and one more thing,
ionic cordova run android works normally, --prod having issue.

@mhartington can you help on this issue…

Im having the same issue with all my plugins. Running ionic cordova build android works perfectly but ionic cordova build android --prod fail with the following error message :

Error: Metadata version mismatch for module /home/thor/Projects/App_CDP/node_modules/@ionic-native/firebase/index.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (/home/thor/Projects/App_CDP/node_modules/@angular/compiler/bundles/compiler.umd.js:23979:34)
    at StaticSymbolResolver._createSymbolsOf (/home/thor/Projects/App_CDP/node_modules/@angular/compiler/bundles/compiler.umd.js:23765:46)
    at StaticSymbolResolver.getSymbolsOf (/home/thor/Projects/App_CDP/node_modules/@angular/compiler/bundles/compiler.umd.js:23746:14)
    at /home/thor/Projects/App_CDP/node_modules/@angular/compiler/bundles/compiler.umd.js:22528:30
    at Array.forEach (<anonymous>)
    at extractProgramSymbols (/home/thor/Projects/App_CDP/node_modules/@angular/compiler/bundles/compiler.umd.js:22527:79)
    at AotCompiler.compileAll (/home/thor/Projects/App_CDP/node_modules/@angular/compiler/bundles/compiler.umd.js:22225:47)
    at CodeGenerator.codegen (/home/thor/Projects/App_CDP/node_modules/@angular/compiler-cli/src/codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/home/thor/Projects/App_CDP/node_modules/@angular/compiler-cli/src/ngtools_api.js:61:30)
    at Object.doCodegen (/home/thor/Projects/App_CDP/node_modules/@ionic/app-scripts/dist/aot/codegen.js:6:51)

When i downgrade the plugin with npm install plugin@3 it work perfectly for this plugin.

and here is for you :

$ ionic info

cli packages: (/usr/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : android 6.4.0 ios 4.5.3
    Ionic Framework    : ionic-angular 3.1.1

System:

    Android SDK Tools : 26.1.1
    Node              : v8.8.1
    npm               : 5.5.1 
    OS                : Linux 4.13

Environment Variables:

    ANDROID_HOME : /opt/android-sdk

Misc:

    backend : pro

2 Likes

I experienced this issue aswell. It’s of Course becasue of Ng5 and the newest Ionic Version is trying to use the newer plugin versions or sth like this. I think downgrading ionic is a solid way, until you’re fully upgrading your Project to Ng5.

Another dirty workaound is going to your plugins Folder, open index.metadata.json and Change Version to ‘3’. :smiley:

2 Likes

I got the same problem but this time its about the @ionic-native/core version and everything works except for --prod flag

D:\mobile\maghribcom>ionic cordova build android --prod
Running app-scripts build: --prod --platform android --target cordova
[15:29:18]  build prod started ...
[15:29:18]  clean started ...
[15:29:18]  clean finished in 71 ms
[15:29:18]  copy started ...
[15:29:18]  deeplinks started ...
[15:29:18]  deeplinks finished in 159 ms
[15:29:18]  ngc started ...
Error: Metadata version mismatch for module D:/mobile/maghribcom/node_modules/@ionic-native/cor
orators.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (D:\mobile\maghribcom\node_modules\@angular\compi
undles\compiler.umd.js:25616:34)
    at StaticSymbolResolver._createSymbolsOf (D:\mobile\maghribcom\node_modules\@angular\compil
ndles\compiler.umd.js:25404:46)
    at StaticSymbolResolver.getSymbolsOf (D:\mobile\maghribcom\node_modules\@angular\compiler\b
s\compiler.umd.js:25385:14)
    at D:\mobile\maghribcom\node_modules\@angular\compiler\bundles\compiler.umd.js:24241:30
    at Array.forEach (native)
    at extractProgramSymbols (D:\mobile\maghribcom\node_modules\@angular\compiler\bundles\compi
md.js:24240:79)
    at AotCompiler.analyzeModulesAsync (D:\mobile\maghribcom\node_modules\@angular\compiler\bun
compiler.umd.js:23796:47)
    at CodeGenerator.codegen (D:\mobile\maghribcom\node_modules\@angular\compiler-cli\src\codeg
:32:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (D:\mobile\maghribcom\node_modules\@angular\co
r-cli\src\ngtools_api.js:73:30)
    at D:\mobile\maghribcom\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:182:73

And here is my info

cli packages: (C:\Users\LENOVO\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : not installed

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v6.11.2
    npm               : 5.5.1
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : D:\sdk\

Misc:

    backend : legacy

I am getting this exact error as well

I was able to run with --prod flag when I downgraded all my ionic-native plugins to version “4.3.3”.
Thanks :slight_smile:

9 Likes

Nice find, this worked for me as well

@camolin3 Thanks, Downgrading ionic native plugins to 4.3.3 worsks for me.

2 Likes

Same error here. but fixed with I removed “^” before 4.3.3

1 Like

Downgrading to 4.3.3 works fine for me.

        "@ionic-native/core": "4.3.3",
        "@ionic-native/globalization": "4.3.3",
        "@ionic-native/google-maps": "4.3.3",
        "@ionic-native/splash-screen": "4.3.3",
        "@ionic-native/status-bar": "4.3.3",
5 Likes

This has worked for me ! Thanks

It worked for me thanks :smiley:

 "@ionic-native/firebase":"4.3.3",
 "@ionic-native/device": "4.3.3",
 "@ionic-native/facebook": "4.3.3",
1 Like

Hi, got the same problem but I might be solving it wrong. Can someone help me, I am a beginner:

Error: Metadata version mismatch for module /Users/…/@ionic-native/file-path/index.d.ts, found version 4, expected 3

In my package .json :slight_smile:

“dependencies”: {
@angular/common”: “4.4.3”,
@angular/compiler”: “4.4.3”,
@angular/compiler-cli”: “4.4.3”,
@angular/core”: “4.4.3”,
@angular/forms”: “4.4.3”,
@angular/http”: “4.4.3”,
@angular/platform-browser”: “4.4.3”,
@angular/platform-browser-dynamic”: “4.4.3”,
@ionic-native/camera”: “^4.3.0”,
@ionic-native/core”: “3.12.1”,
@ionic-native/facebook”: “^4.3.1”,
@ionic-native/file”: “^4.3.0”,
@ionic-native/file-path”: “^4.3.0”,
@ionic-native/geolocation”: “^4.3.2”,
@ionic-native/globalization”: “^4.3.3”,
@ionic-native/google-maps”: “^4.3.1”,
@ionic-native/native-geocoder”: “^4.3.2”,
@ionic-native/splash-screen”: “3.12.1”,
@ionic-native/status-bar”: “3.12.1”,
@ionic-native/transfer”: “^3.14.0”,
@ionic/storage”: “2.0.1”,
@types/google-maps”: “^3.2.0”,
“cordova-android”: “^6.2.3”,
“cordova-ios”: “^4.5.2”,
“cordova-plugin-add-swift-support”: “^1.7.0”,
“cordova-plugin-camera”: “^3.0.0”,
“cordova-plugin-compat”: “^1.2.0”,
“cordova-plugin-device”: “^1.1.6”,
“cordova-plugin-facebook4”: “^1.9.1”,
“cordova-plugin-file”: “^5.0.0”,
“cordova-plugin-file-transfer”: “^1.7.0”,
“cordova-plugin-filepath”: “^1.1.0”,
“cordova-plugin-geolocation”: “^2.4.3”,
“cordova-plugin-globalization”: “^1.0.7”,
“cordova-plugin-googlemaps”: “^2.0.11”,
“cordova-plugin-googlemaps-sdk”: “git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git”,
“cordova-plugin-nativegeocoder”: “^2.0.4”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.3”,
“cordova-plugin-whitelist”: “^1.3.2”,
“ionic-angular”: “3.7.0”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“ng-socket-io”: “^0.1.11”,
“ng2-translate”: “^5.0.0”,
“rxjs”: “5.4.3”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.17”
},

I have tried to set
@ionic-native/file”: “^4.3.0”,
to
@ionic-native/file”: “^3.3.0”,
and run npm install.
But it might not be the right way to “downgrade” a version as you are suggesting.
Can anybody help me on this one please ? :slight_smile:

It happening too with network plugin… what version works?

Thanks

update statusbar,splashscreen , ionic core and transfer