使用此命令-> ng s运行我的程序时遇到此错误
”未找到导出“ FirebaseNameOrConfigToken”(导入为“ i57”) 在'@ angular / fire'中 ./src/app/app.module.ngfactory.js 126中的错误:16579-16-16 “在'@ angular / fire'中找不到导出'FirebaseNameOrConfigToken'(导入为'i57') ./src/app/app.module.ngfactory.js 126:6876-6900中的错误 “在'@ angular / fire'中找不到导出'FirebaseOptionsToken'(导入为'i57') ./src/app/app.module.ngfactory.js 126:7016-7040中的错误 “在'@ angular / fire'中找不到导出'FirebaseOptionsToken'(导入为'i57') ./src/app/app.module.ngfactory.js 126中的错误:16194-16218 “在'@ angular / fire'中找不到导出'FirebaseOptionsToken'(导入为'i57') ./src/app/app.module.ngfactory.js 126:7082-7105中的错误 “在'@ angular / fire'中找不到导出'RealtimeDatabaseURL'(导入为'i57') ./src/app/app.module.ngfactory.js 126:6850-6873中的错误 “在'@ angular / fire'中找不到导出'_firebaseAppFactory'(导入为'i57')
Angular Live Development Server在localhost:4200上侦听,打开 您在http:// localhost:4200 /
上的浏览器
这是我的package.json文件:
"dependencies": {
"@angular/animations": "~9.1.9",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.9",
"@angular/compiler": "~9.1.9",
"@angular/core": "~9.1.9",
"@angular/fire": "^6.0.2",
"@angular/forms": "~9.1.9",
"@angular/http": "^7.2.16",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.9",
"@angular/platform-browser-dynamic": "~9.1.9",
"@angular/router": "~9.1.9",
"al-shah": "^1.9.7",
"angularfire2": "^5.4.2",
"firebase": "^7.16.0",
"firebase-tools": "^8.4.3",
"http": "0.0.1-security",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
和app.module.ts:
import { AngularFireModule } from "angularfire2";
import { AppRoutingModule } from "./modules/app-routing.module";
import { firebaseConfig } from "./firebase/firebase-config";
imports:[
AngularFireModule.initializeApp(firebaseConfig),
AngularFireDatabaseModule,
],
此处moto.component.ts
export class MotoComponent {
mobParts: any[];
constructor(private angularFireDatabase: AngularFireDatabase) {
angularFireDatabase
.list("/motoData")
.valueChanges()
.subscribe((mobParts) => {
this.mobParts = mobParts;
console.log(this.mobParts);
});
}
}
我有firebase / firebase.json
export var firebaseConfig = {
apiKey: "AIzaSyCx2EGL7OKRwWTQA3qn34GWLm1DVQ-trMI",
authDomain: "mymart-fcca0.firebaseapp.com",
databaseURL: "https://mymart-fcca0.firebaseio.com",
projectId: "mymart-fccb0",
storageBucket: "mymart-fccb0.appspot.com",
messagingSenderId: "1088382632990",
appId: "1:1088382632990:web:49c0c48346f5ffb46e5a0f",
measurementId: "G-ZFMB1PQLVN",
};