我收到错误: - 找不到模块:错误:无法解决&rxjs / Observable'在&C; \ Users \ suraj \ Desktop \ new \ node_modules \ angularfire2 \ database \ list'

时间:2018-05-12 05:03:47

标签: angular rxjs

我在以角度编码时遇到以下错误,并且不知道该怎么做

找不到模块:错误:

  

无法解决&rxjs / Observable'在   ' C:\用户\ SURAJ \桌面\新\ Ennobleadmin \ node_modules \ angularfire2 \数据库\列表'

package.json file 
{
  "name": "ennobleadmin",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/router": "^6.0.0",
    "angularfire2": "^5.0.0-rc.3",
    "core-js": "^2.5.4",
    "firebase": "^4.6.1",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.1",
    "@angular/cli": "~6.0.1",
    "@angular/compiler-cli": "^6.0.0",
    "@angular/language-service": "^6.0.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "^2.0.10"
  }
}

2 个答案:

答案 0 :(得分:8)

angularfire2 v5.0.0-rc.3正在使用rxjs 5.x。你有两种方式。

1:升级AngularFire2 Libary。

npm install --save angularfire2@latest

,或者

2:安装rxjs-compat

npm install --save rxjs-compat

答案 1 :(得分:0)

update
angularfire2包已被弃用,现在您不应该使用它。
新软件包的名称为@angular/fire
而且npm install --save angularfire2@latest 也不是解决方案,因为您可以直接安装并使用它,但该问题已被取消,并且也没有提供支持。
您可以使用npm install --save rxjs-compat弃用版本来解决此错误。

有关最新版本,请使用npm install @angular/fire