Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Firebase有问题吗?_Javascript_Typescript_Firebase_Angular6 - Fatal编程技术网

Javascript Firebase有问题吗?

Javascript Firebase有问题吗?,javascript,typescript,firebase,angular6,Javascript,Typescript,Firebase,Angular6,我正在使用google firebase创建用户注册系统,我遵循本教程: 注意 :我正在使用此版本的“firebase”:“^5.5.6” 当我运行我的应用程序时,我出现以下错误: ERROR in src/app/login/login.component.ts(2,10): error TS2305: Module '"C:/Users/jelly/projects/profile/node_modules/angularfire2/index"' has no exported memb

我正在使用google firebase创建用户注册系统,我遵循本教程:

注意

:我正在使用此版本的“firebase”:“^5.5.6”

当我运行我的应用程序时,我出现以下错误:

ERROR in src/app/login/login.component.ts(2,10): error TS2305: Module '"C:/Users/jelly/projects/profile/node_modules/angularfire2/index"' has no exported member 'AngularFire'.
src/app/login/login.component.ts(3,28): error TS2305: Module '"C:/Users/jelly/projects/profile/node_modules/angularfire2/firestore/index"' has no exported member 'AuthProviders'.
src/app/login/login.component.ts(3,43): error TS2305: Module '"C:/Users/jelly/projects/profile/node_modules/angularfire2/firestore/index"' has no exported member 'AuthMethods'.
这是app.modul.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule, JsonpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { UserProfileComponent } from './user-profile/user-profile.component';
import {HttpClientModule} from '@angular/common/http';
import { UserService } from './service/user.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { MomentModule } from 'ngx-moment';
import { AngularFireModule } from 'angularfire2';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { LoginComponent } from './login/login.component';
import { EmailComponent } from './email/email.component';
import { SignupComponent } from './signup/signup.component';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule} from 'angularfire2/database';



const firebaseConfig = {
  apiKey: '',
  authDomain: '',
  databaseURL: '',
  projectId: '',
  storageBucket: '',
  messagingSenderId: ''
};


@NgModule({
  declarations: [
    AppComponent,
    UserProfileComponent,
    LoginComponent,
    EmailComponent,
    SignupComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    NgbModule,
    BrowserModule,
    MomentModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    AngularFireAuthModule,
    BrowserModule,
    AngularFirestoreModule,
    AngularFireModule.initializeApp(firebaseConfig),
    AngularFireDatabaseModule,
    HttpModule,
    FormsModule,
    HttpClientModule,
    ReactiveFormsModule,
    RouterModule,
    AppRoutingModule,
  ],
  providers: [UserService],
  bootstrap: [AppComponent]
})
export class AppModule { }
这里是登录组件和其他组件的权利只是empyt

import { Component, OnInit } from '@angular/core';
import { AngularFire, } from 'angularfire2';
import { AngularFirestore, AuthProviders, AuthMethods, AngularFirestoreCollection, AngularFirestoreDocument } from 'angularfire2/firestore';
import { Router } from '@angular/router';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {

  // declare empyt array to hold error data
  error: any;

  constructor(public af: AngularFire, private router: Router) {

  // fucntion to check user authentication
    this.af.auth.subscribe(auth => {
      if (auth) {
        this.router.navigateByUrl('/members');
      }
    });
   }

  // function to login in facebook
  loginFb() {
    this.af.auth.login({
      provider: AuthProviders.Facebook,
      method: AuthMethods.Popup,
    }).then(
      (success) => {
        this.router.navigate(['/members']);
    }).catch(
      (err) => {
        this.error = this.error;
      });
  }

    // function to login with google
    loginGoogle() {
      this.af.auth.login({
        provider: AuthProviders.Facebook,
        method: AuthMethods.Popup,
      }).then(
        (success) => {
          this.router.navigate(['/members']);
      }).catch(
        (err) => {
          this.error = this.error;
        });
    }

  ngOnInit() {
  }

}
我已经使用了几乎所有的堆栈溢出解决方案,但没有任何效果,我现在就要放弃了,我没有看到任何好的文档让傻瓜们了解到底发生了什么:(


要消除此错误,我需要做哪些更改?请帮助教程从2017年1月17日开始,如果您运行
npm install angularfire2 firebase--save
您将安装最新版本的firebase,它不是教程的基础,请看这里


因此,您必须将用于此项目的firebase版本降级,或升级导入,使其指向正确的文件,您可以在其中找到所需的类

您使用哪个firebase版本?@Jake11“firebase”:“^5.5.6”,所以他们在tut中使用的版本是~3.6.5,您可以尝试降级到它,或者尝试按照发行说明查找这些类的移动位置,或者只是在文档中搜索可以找到它们的文档,以查找您正在使用的版本。如果您决定降级,我不确定,但您可能还必须将angularfire2降级到较旧的版本幸运的是,降低火源等级仍然有错误,还有许多其他的错误。我尝试了所有这些方法,但都无效:(这就是我需要一些的原因。)help@user9964622您有什么版本的angularfire2?“angularfire2”:“^5.1.0”,?@user9964622运行npm删除angularfire2angularfire2@2.0.0-beta.7--保存->
npm删除firebase
->
npm安装firebase@3.6.5--保存
->重新启动应用程序->告诉我是否仍有错误现在我收到此错误:
类型“AngularFireAuth”上不存在“订阅”。