9

ERROR in Error: Metadata version mismatch for module C:/projects/youtube-angular/firestore-app/node_modules/angularfire2/index.d.ts, found version 4, expected 3,

I have never seen this. I tried to uninstall everything and reinstall to newest versions and still getting that error. No one else running the project seems to have this issue. So i am guessing that is some local setting or install i have wrong but can't figure this one out.

package.json
{
  "name": "firestore-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "angularfire2": "^5.0.0-rc.4",
    "core-js": "^2.4.1",
    "firebase": "^4.6.2",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "materialize-css": "^0.100.2",
    "rxjs": "^5.4.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.4.7",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.3.3"
  }
}
shaunhusain
  • 19,630
  • 4
  • 38
  • 51
Firecore
  • 137
  • 1
  • 6
  • 1
    Have you tried completely deleting your node_modules folder and clean install? sounds like a lingering old module installed possibly. Could also try to clean out any npm cache you have going https://docs.npmjs.com/cli/cache – shaunhusain Nov 18 '17 at 04:56
  • Ya i just started a new project (ng new ...)then copied exact same code over, then npm installed angularfire2 and works fine....not sure what happened but agree something didn't install properly. thanks for your reply. – Firecore Nov 18 '17 at 10:38
  • This thing is not intermittent or environment issue for me, notably it happening while calling `AotPlugin._getLazyRoutesFromNgtools ` inside `@ngtools/webpack`. Secondly it happens on server launch only, if I make some code change and allow server to auto refresh I don't see it. – ishandutta2007 Nov 19 '17 at 23:13
  • I had exact same issue in my angular app. My [resolution](https://stackoverflow.com/a/47694285/8680456) is posted in here. – Prasad Kaiche Dec 07 '17 at 11:47

3 Answers3

11

I faced the same problem but solved it by changing the release candidate on angularfire2 back to 3 like "angularfire2": "^5.0.0-rc.3" from "angularfire2": "^5.0.0-rc.4" in your package.json file. then delete node modules and run npm i or npm install.

Or you can unintall angularfire2 make sure you also remove it from your package.json and package.json.lock files. reinstall it and specify the release candidate like npm install angularfire2@5.0.0-rc.3 --save.

ghkatende
  • 477
  • 6
  • 17
2

In my case I had to change the cli version and the angularfire2 version too

npm install @angular/cli@ version 1.2.1 --save

npm install angularfire2@5.0.0-rc.3 --save
  • 1
    In my case, I didn't need to downgrade @angular/cli, I just execute " npm install angularfire2@5.0.0-rc.3 --save " that can add other packages as well – Smaillns Dec 11 '17 at 23:31
0

I tried everything and it didn't work. The only answer that help me was to update all @angular packages like @angular/common, @angular/compiler, @angular/compiler-cli, "@angular/core, etc to latest versions (5.1.1).

After that I also need to update rxjs to latest (5.5.5).

Than is compiled successfully with --prod.

RafaelJan
  • 3,118
  • 1
  • 28
  • 46