Search code examples
angularnpmmean-stackflash-message

Error in error: Metadata version mismatch for angular2-flash-messages


I'm going through Traversy Media on YouTube's MEAN stack front to back playlist and after importing the flash-messages, the console is giving the error and I can not understand. I've read few gitHub issue pages but they don't lead to anything.

ERROR in Error: Metadata version mismatch for module B:/Shall/Practice/meanauthapp/angular-src/node_modules/angular2-flash-messages/module/index.d.ts, found version 4, expected 3, resolving symbol AppModule in B:/Shall/Practice/meanauthapp/angular-src/src/app/app.module.ts, resolving symbol AppModule in B:/Shall/Practice/meanauthapp/angular-src/src/app/app.module.ts
at SyntaxError.BaseError [as constructor] (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler\bundles\compiler.umd.js:1597:31)
at new SyntaxError (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler\bundles\compiler.umd.js:1795:20)
at simplifyInContext (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler\bundles\compiler.umd.js:25774:27)
at StaticReflector.simplify (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler\bundles\compiler.umd.js:25786:17)
at StaticReflector.annotations (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler\bundles\compiler.umd.js:25282:64)
at _getNgModuleMetadata (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler-cli\src\ngtools_impl.js:126:31)
at _extractLazyRoutesFromStaticModule (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler-cli\src\ngtools_impl.js:101:26)
at Object.listLazyRoutesOfModule (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler-cli\src\ngtools_impl.js:52:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@angular\compiler-cli\src\ngtools_api.js:78:39)
at AotPlugin._getLazyRoutesFromNgtools (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@ngtools\webpack\src\plugin.js:241:66)
at _donePromise.Promise.resolve.then.then.then.then.then (B:\Shall\Practice\meanauthapp\angular-src\node_modules\@ngtools\webpack\src\plugin.js:495:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

My package.json file is as follows:

{
  "name": "angular-src",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/animation": "^4.0.0-beta.8",
    "@angular/common": "^2.3.1",
    "@angular/compiler": "^2.3.1",
    "@angular/core": "^2.3.1",
    "@angular/forms": "^2.3.1",
    "@angular/http": "^2.3.1",
    "@angular/platform-browser": "^2.3.1",
    "@angular/platform-browser-dynamic": "^2.3.1",
    "@angular/router": "^3.3.1",
    "angular2-flash-messages": "^2.0.5",
    "core-js": "^2.4.1",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^2.3.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.28.3",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.3"
  }
}

Solution

  • If this counts or no, but someone suggested me to do npm install @[email protected]

    and Voila! it worked! Do suggest some other technical details that might justifies this.