gpt4 book ai didi

angularfire2 找不到模块 'firebase/app'

转载 作者:行者123 更新时间:2023-12-03 18:30:50 27 4
gpt4 key购买 nike

应用程序组件:

import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { RoomComponent } from './component/room/room.component';
import { AngularFireAuth } from '@angular/fire/auth';
import { FirebaseService } from "./service/firebase.service";
import { AngularFireAuthModule } from 'angularfire2/auth';


imports: [
BrowserModule,
AngularFireModule.initializeApp(firebaseconfig),
AngularFirestoreModule
],
providers: [
FirebaseService,
{
provide: PERFECT_SCROLLBAR_CONFIG,
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG
},
AngularFireAuth
],

package.json 文件:
{
"dependencies": {
"@angular/animations": "^5.2.11",
"@angular/cdk": "^5.2.4",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.4",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"angularfire2": "^5.0.1",
"core-js": "^2.4.1",
"dateformat": "^3.0.3",
"firebase": "^5.5.1",
"rxjs": "^6.3.2",
"rxjs-compat": "^6.3.2",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "~1.7.4",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}

不起作用的导入位于服务中:
import { AngularFirestore, AngularFirestoreCollection, 
AngularFirestoreDocument } from 'angularfire2/firestore';
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app'
import { Observable } from 'rxjs';

我只包括了可能与错误有关的依赖项,但如果我遗漏了什么,请告诉我。

我已经尝试了多个版本。这确实有效,但它有一个错误。问题在于允许我登录到 Firebase 的 import { auth }。我不知道问题是什么。有时它编译,有时它不编译。这是迄今为止我使用的唯一版本组合,有时即使出现错误也能编译。其他版本只是破坏了其他导入。

只有当我暂时删除身份验证导入然后将其放回然后保存时,该项目才会编译。

最佳答案

npm install firebase

解决了我的问题

关于angularfire2 找不到模块 'firebase/app',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52523258/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com