【问题标题】:Attempted import error: 'FetchXmlHttpFactory' is not exported from '@firebase/webchannel-wrapper' (imported as 'v')尝试导入错误:“FetchXmlHttpFactory”未从“@firebase/webchannel-wrapper”导出(导入为“v”)
【发布时间】:2021-08-22 01:19:49
【问题描述】:

我已将我的 firebase 链接到我的项目,以便将其用于 Google 身份验证,但此问题不断出现。

import firebase from "firebase/app";

import "firebase/firestore";
import "firebase/auth";

const config = {
  apiKey: "************************",
  authDomain: "********************",
  projectId: "****************",
  storageBucket: "***********************,
  messagingSenderId: "*************************",
  appId: "******************************",
  measurementId: "******************",
};

firebase.initializeApp(config);

export const auth = firebase.auth();
export const firestore = firebase.firestore();

const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({ prompt: "select_account" });
export const signInWithGoogle = () => auth.signInWithPopup(provider);

export default firebase;

【问题讨论】:

    标签: javascript reactjs firebase google-authentication


    【解决方案1】:

    您好,我也遇到了这个错误,它不是代码中的错误,而是依赖关系。 firebase 包刚刚更新到 8.6.4,检查是否安装了这个版本,如果是,则将其降级到 firebase@8.6.3,这是稳定的,对我有用。

    【讨论】:

      【解决方案2】:

      刚刚在您的 package.json 文件中发现了问题检查,以查看您使用的 firebase 版本。如果您有 firebase 版本:8.6.4,请使用 npm uninstall firebase 卸载。然后使用npm install firebase@8.6.3重新安装

      【讨论】:

      • 它确实解决了我在 localhost 中的问题,但是当我尝试部署到 netlify.com 时,它会抛出同样的错误。
      • @Emilis 所以我遇到了同样的问题,为了解决这个问题,我再次使用上面的代码卸载了它。然后重新安装了 7.20.0 版本。我使用 vercel 进行部署,但在我的终端显示“编译成功”之前它无法工作。还要确保在 firebase 的授权域选项卡中添加您的部署域。祝你好运!
      猜你喜欢
      • 1970-01-01
      • 2021-02-13
      • 2021-06-27
      • 2021-11-18
      • 2021-02-09
      • 2021-10-26
      • 2021-03-08
      • 2022-11-16
      • 2021-04-08
      相关资源
      最近更新 更多