【问题标题】:cant build project ERROR: 'FetchXmlHttpFactory' is not exported from '@firebase/webchannel-wrapper'无法构建项目错误:“FetchXmlHttpFactory”未从“@firebase/webchannel-wrapper”导出
【发布时间】:2021-06-04 13:49:32
【问题描述】:

我正在尝试构建我的项目,但出现错误: 创建优化的生产构建... 编译失败。

./node_modules/@firebase/firestore/dist/esm5/prebuilt-db9cc925-eb007c37.js 尝试导入错误:“FetchXmlHttpFactory”未从中导出 '@firebase/webchannel-wrapper'(导入为'v')。

npm 错误!代码 ELIFECYCLE npm 错误! errno 1 npm 错误!测试管理员@0.1.0 构建:react-scripts build npm 错误!退出状态 1 npm ERR! npm 错误! 在 test-admin@0.1.0 构建脚本中失败。 npm 错误!这大概是 npm 没问题。可能有额外的日志输出 以上。

我尝试安装最新的 firebase,但没有成功。这是我的 package.json:

"dependencies": {
    "@firebase/firestore": "^2.3.3",
    "@firebase/webchannel-wrapper": "0.4.1",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "firebase": "^8.6.4",
    "prop-types": "^15.7.2",
    "ra-data-json-server": "^3.14.2",
    "react": "^17.0.2",
    "react-admin": "^3.14.2",
    "react-admin-firebase": "^3.2.17",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-swipeable-views": "^0.14.0",
    "web-vitals": "^1.0.1"
  },

这是我的 firebase 配置文件:

import firebase from "firebase/app";
import "firebase/firestore";
export const config = {
  apiKey: *******,
  authDomain: *******,
  databaseURL: *******,
  projectId: *******,
  storageBucket: *******,
  messagingSenderId:*******,
  appId: *******,
  measurementId: *******,
};

export const options = {
  logging: false,
  rootRef: "root_collection/some_document",
};

if (!firebase.apps.length) {
  firebase.initializeApp(config);
}
const db = firebase.firestore();
export default db;

【问题讨论】:

    标签: reactjs firebase npm


    【解决方案1】:

    我之前也遇到过同样的问题。这就是我解决它的方法。 如果您有 firebase 版本:8.6.4,请使用 npm uninstall firebase 卸载。然后使用npm install firebase@8.6.3重新安装

    【讨论】:

      猜你喜欢
      • 2021-08-22
      • 2018-03-15
      • 1970-01-01
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-11
      • 2015-12-01
      相关资源
      最近更新 更多