I've got the following error
Metadata version mismatch for module c:/..../node_modules/angularfire2/index.d.ts, found version4, expected 3.
And if I go and check in my package.json, I have angularfire2 on version 5.0.0-rc.4, and firebase on 4.6.2. see screenshot for details
I tried changing the version of angularfire2 and firebase to previous versions but nothing worked.
Any suggestions ? Thank you.
{
"name": "twitter-revamped",
"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",
"ng2-semantic-ui": "^0.9.6",
"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"
}
}
This is how I solved this problem. Follow the steps as i have listed:
STEP 1: Uninstall previous angularfire2 installed pacakge
npm uninstall angularfire2
STEP 2: Install angularfire2 5.0.0-rc.3
npm install [email protected] --save
STEP 3: Check your package.json
Make sure you have the following lines under dependencies in package.json
"angularfire2": "^5.0.0-rc.3",
"firebase": "^4.6.0",
This is how i solved the problem.
I solved it
Had to set firebase and angularfire2 to this:
"firebase":"4.6.0",
"angularfire2": "5.0.0-rc.3"
but then I got another error:"@angular/compiler-cli" package was not properly installed. Error: Error: Cannot find module '@angular/compiler-cli'
A npm install fixed it.
I tried above solutions but it didn't solve my issue. I tried the below steps & it solved my issue.
The issue actually occurred when npm install angularfire2 firebase --save
command was run. Below dependencies were added in package.json
"angularfire2": "^5.0.0-rc.4",
"firebase": "^4.7.0"
Actual issue here is due to the version of angularfire2. We need to have angularfire2": "^5.0.0-rc.3 instead of angularfire2": "^5.0.0-rc.4. I am not aware as to why this version is having issue.
Below are the steps for resolution:
STEP 1: Uninstall angularfire2 & firebase
npm uninstall angularfire2 firebase --save
STEP 2: Install angularfire2 5.0.0-rc.3 version
npm install [email protected] --save
STEP 3: Install firebase
npm install firebase --save
STEP 4: Check dependencies added in package.json
"angularfire2": "^5.0.0-rc.3",
"firebase": "^4.7.0"
STEP 5: Execute ng serve
ng serve
This solves the issue & application compiles successfully.
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 [email protected] --save
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With