错误中的错误:模块的元数据版本不匹配../node_modules/angularfire2/index.d.ts,找到版本4,预期3,

时间:2017-11-18 04:03:29

标签: angular firebase

错误中的错误:模块C的元数据版本不匹配:/projects/youtube-angular/firestore-app/node_modules/angularfire2/index.d.ts,找到版本4,预期3,

我从未见过这个。我试图卸载所有内容并重新安装到最新版本,但仍然出现错误。没有其他人运行该项目似乎有这个问题。所以我猜这是一些本地设置或安装我错了但不能解决这个问题。

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"
  }
}

3 个答案:

答案 0 :(得分:10)

我遇到了同样的问题但是通过将angularfire2上的候选版本从package.json文件中的"angularfire2": "^5.0.0-rc.3"更改为3 "angularfire2": "^5.0.0-rc.4"来解决它。然后删除节点模块并运行npm i or npm install

或者你可以unintall angularfire2确保你也从package.json和package.json.lock文件中删除它。重新安装它并指定候选版本npm install angularfire2@5.0.0-rc.3 --save

答案 1 :(得分:2)

在我的情况下,我不得不更改cli版本和angularfire2版本

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

npm install angularfire2@5.0.0-rc.3 --save

答案 2 :(得分:0)

我尝试了一切,但它没有奏效。唯一能帮到我的答案是将@ angular / common,@ angular / compiler,@ angular / compiler-cli," @ angular / core等所有@angular软件包更新到最新版本(5.1.1)。

之后我还需要将rxjs更新为最新版本(5.5.5)。

使用--prod。

成功编译