Error: Metadata version mismatch for module /mobile/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3

Hi I have this error when try to run a command:
sudo ionic cordova run android --prod --release

Error:

ionic-app-script task: "build"
[16:58:40]  Error: Metadata version mismatch for module
            /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@ionic-native/core/decorators.d.ts,
            found version 4, expected 3
Error: Metadata version mismatch for module /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:25616:34)
    at StaticSymbolResolver._createSymbolsOf (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:25404:46)
    at StaticSymbolResolver.getSymbolsOf (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:25385:14)
    at /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:24241:30
    at Array.forEach (<anonymous>)
    at extractProgramSymbols (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:24240:79)
    at AotCompiler.analyzeModulesAsync (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:23796:47)
    at CodeGenerator.codegen (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
    at Function.NgTools_InternalApi_NG_2.codeGen (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
    at /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:182:73

Here are my dependecies:

"dependencies": {
    "@angular/cli": "^6.0.8",
    "@angular/common": "^4.4.7",
    "@angular/compiler": "^4.4.7",
    "@angular/compiler-cli": "^4.4.7",
    "@angular/core": "^4.4.7",
    "@angular/forms": "^4.4.7",
    "@angular/http": "^4.4.7",
    "@angular/platform-browser": "^4.4.7",
    "@angular/platform-browser-dynamic": "^4.4.7",
    "@ionic-native/background-mode": "^4.4.2",
    "@ionic-native/badge": "^4.4.2",
    "@ionic-native/camera": "^4.4.2",
    "@ionic-native/core": "^4.4.2",
    "@ionic-native/file": "^4.4.2",
    "@ionic-native/file-path": "^4.4.2",
    "@ionic-native/file-transfer": "^4.16.0",
    "@ionic-native/image-picker": "^4.4.2",
    "@ionic-native/local-notifications": "^4.4.2",
    "@ionic-native/push": "^4.4.2",
    "@ionic-native/splash-screen": "^4.4.2",
    "@ionic-native/status-bar": "^4.4.2",
    "@ionic/cloud-angular": "^0.12.0",
    "@ionic/storage": "^2.1.3",
    "ajv": "^5.5.2",
    "clean-css": "^4.1.11",
    "cli-update": "^3.2.5",
    "cordova": "^8.0.0",
    "cordova-android": "^6.4.0",
    "cordova-browser": "^5.0.3",
    "cordova-ios": "^4.5.5",
    "cordova-plugin-add-swift-support": "^1.7.2",
    "cordova-plugin-background-mode": "^0.7.2",
    "cordova-plugin-badge": "^0.8.7",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-console": "1.0.5",
    "cordova-plugin-device": "1.1.4",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-filepath": "^1.3.0",
    "cordova-plugin-ionic": "^2.0.4",
    "cordova-plugin-ionic-keyboard": "~2.0.5",
    "cordova-plugin-local-notification": "^0.9.0-beta.2",
    "cordova-plugin-splashscreen": "~4.0.1",
    "cordova-plugin-statusbar": "2.2.1",
    "cordova-plugin-telerik-imagepicker": "^2.2.2",
    "cordova-plugin-whitelist": "1.3.1",
    "hoek": "^5.0.3",
    "https-proxy-agent": "^2.2.1",
    "intl": "^1.2.5",
    "ionic-angular": "^3.9.2",
    "ionic-native": "^2.9.0",
    "ionic-plugin-deploy": "^0.6.7",
    "ionic-plugin-keyboard": "~2.2.1",
    "ionicons": "3.0.0",
    "jquery": "^3.3.1",
    "jquery-touchswipe": "^1.6.15",
    "lodash": "^4.17.10",
    "moment": "^2.22.2",
    "npm": "^6.2.0",
    "phonegap-plugin-push": "^1.11.1",
    "rxjs": "^5.5.11",
    "sw-toolbox": "^3.6.0",
    "swift": "^0.1.8",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.0",
    "@types/node": "^10.5.2",
    "node-sass": "^4.9.2",
    "rebuild-node-sass": "^1.1.0",
    "tunnel-agent": "^0.6.0",
    "typescript": "2.4.0"
  },

When I run npm outdate command I get:

@angular/cli                         6.2.5   6.2.5   7.0.1 
@angular/common                      4.4.7   4.4.7   7.0.0 
@angular/compiler                    4.4.7   4.4.7   7.0.0 
@angular/compiler-cli                4.4.7   4.4.7   7.0.0 
@angular/core                        4.4.7   4.4.7   7.0.0 
@angular/forms                       4.4.7   4.4.7   7.0.0 
@angular/http                        4.4.7   4.4.7   7.0.0 
@angular/platform-browser            4.4.7   4.4.7   7.0.0 
@angular/platform-browser-dynamic    4.4.7   4.4.7   7.0.0 
ajv                                  5.5.2   5.5.2   6.5.4 
cordova-android                      6.4.0   6.4.0   7.1.1 
cordova-plugin-console               1.0.5   1.0.5   1.1.0 
cordova-plugin-device                1.1.4   1.1.4   2.0.2 
cordova-plugin-ionic                 2.0.4   2.0.4   5.2.5 
cordova-plugin-ionic-keyboard        2.0.5   2.0.5   2.1.3 
cordova-plugin-splashscreen          4.0.3   4.0.3   5.0.2 
cordova-plugin-statusbar             2.2.1   2.2.1   2.4.2 
cordova-plugin-whitelist             1.3.1   1.3.1   1.3.3 
ionicons                             3.0.0   3.0.0   4.4.6 
phonegap-plugin-push                1.11.1  1.11.1   2.2.3 
rxjs                                5.5.12  5.5.12   6.3.3 
swift                                0.1.8   0.1.8   2.0.1 
typescript                           2.4.0   2.4.0   3.1.3

When I run ionic info command I get:

Ionic:

   ionic (Ionic CLI)  : 4.2.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 6.4.0, browser 5.0.1, ios 4.5.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.0.5, (and 15 other plugins)

I try to solve it few days, read related topics but I can not move forward much. Guess 1 or 2 plugins are not synchronized. Please can someone take a look?

Thanks in advance

1 Like

Hi, I am seeing this very same issue. Does anyone have any suggestions?

√ Gathering environment info - done!

Ionic:

ionic (Ionic CLI) : 4.3.0 (C:\Users\craig\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 6.4.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 7 other plugins)

System:

NodeJS : v8.11.1 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

Ionic repair did not resolve the issue.

I got on to Ionic Pro support who, within a couple of hours, gave me the following steps that resolved the issue for me.

Thanks for reaching out to the Ionic Pro support team.

This is most likely being caused by the inclusion of the prod flag in your build command. Instead of including --prod when you call cordova build try adding the flag to your build script in package.json.

package.json
replace this:

"build": "ionic-app-scripts build",

with this:

"build": "ionic-app-scripts build --prod",

Then try running ionic cordova build android --release

12 Likes

It’s work in my App,
Thank you so much.

Thanks… i spend 10 hours to try to repair it

Thanks so much. you saved me big time

1 Like

The build works but not Sign in the launch mode