How to use calendar in ionic project without any error after building project?


#1

I installed “npm install ion2-calendar moment --save” for calendar

after I ran command “ionic cordova build android --prod”

I got following error:-
Error: Metadata version mismatch for module node_modules/ion2-ca
lendar/dist/calendar.model.d.ts, found version 4, expected 3

Ionic info:-

cli packages: 

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.6.1

System:

    Android SDK Tools : 26.1.1
    Node              : v6.10.3
    npm               : 4.6.1
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : D:\Android\sdk

Misc:

    backend : pro

Angular version:-

angular-cli: 1.0.0-beta.28.3
node: 6.10.3
os: win32 x64
@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
@angular/cli: 1.4.3

#2

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update

Current version here is 3.9.2.

You could use https://update.ionic.zone to help updating this.