我遇到一个问题,它说我找不到该模块。我所走的错误发布在下面:我目前正在使用Ionic4。我不确定,但是Ionic 4是否支持角度功能?
../../../node_modules/@angular/fire/angularfire2.d.ts(1,40): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/fire/angularfire2.d.ts(2,42): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/database/database.d.ts(1,24): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/fire/database/interfaces.d.ts(1,28): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/database/interfaces.d.ts(2,26): error TS2307: Cannot find module 'firebase'.
../../../node_modules/@angular/fire/database/list/audit-trail.d.ts(2,28): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/database/list/changes.d.ts(1,28): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/database/list/snapshot-changes.d.ts(1,28): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/database/list/state-changes.d.ts(2,28): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/database/observable/fromRef.d.ts(2,28): error TS2307: Cannot find module 'rxjs'.
../../../node_modules/@angular/fire/firebase.app.module.d.ts(1,32): error TS2307: Cannot find module '@angular/core'.
../../../node_modules/@angular/fire/firebase.app.module.d.ts(2,79): error TS2307: Cannot find module 'firebase'.
这是我的app.module.ts文件。我需要更新我的rxjs和更新我的angular吗?我不确定该怎么办。
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
FormsModule,
ReactiveFormsModule
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
这是我的package.jason
"name": "event-manager",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@capacitor/cli": "1.0.0-beta.19",
"@capacitor/core": "1.0.0-beta.19",
"@ionic-native/core": "^5.0.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"core-js": "^2.5.4",
"firebase": "^5.9.2",
"rxjs": "~6.3.3",
"zone.js": "~0.8.29"
},
"devDependencies": {
"@angular-devkit/architect": "~0.12.3",
"@angular-devkit/build-angular": "~0.13.0",
"@angular-devkit/core": "~7.2.3",
"@angular-devkit/schematics": "~7.2.3",
"@angular/cli": "~7.3.1",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "~7.2.2",
"@angular/language-service": "~7.2.2",
"@ionic/angular-toolkit": "~1.4.0",
"@types/node": "~10.14.2",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~8.0.0",
"tslint": "~5.12.0",
"typescript": "~3.1.6"
},
"description": "An Ionic project"
}
我在搞乱
import { Component } from '@angular/core';
import { Quiz } from '../services/event/quiz.interface';
import { EventCreatePage } from '../pages/event-create/event-create.page';
import {AngularFireList} from 'angularfire2/database';
import { AngularFireDatabase} from 'angularfire2/database';
import { Router } from '@angular/router';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
quiz = {} as Quiz;
eventcreatePage = EventCreatePage;
quiz$ : AngularFireList<Quiz>;
constructor (private database: AngularFireDatabase,private router: Router) {
this.quiz$ = this.database.list('quiz');
}
onclick (quiz : Quiz){
this.router.navigateByUrl('EventCreatePage, quiz');
}
}
答案 0 :(得分:0)
@angular/fire
不在您的依赖范围内,或者您可以执行npm i --save @angular/fire