简体   繁体   English

为什么我在使用 firebase 时收到尝试导入错误?

[英]Why am I getting the attempted import error when using firebase?

My client code written in React was working just minutes ago and it suddenly stopped working.我用 React 编写的客户端代码几分钟前还在工作,但突然停止工作了。 I can't figure it out.我想不通。 What I have done is just delete contents of 'README.md'.我所做的只是删除“README.md”的内容。 Can anyone help me on this problem?谁能帮我解决这个问题? I got the error below after running 'yarn start'.运行“yarn start”后出现以下错误。

./node_modules/@firebase/firestore/dist/esm5/prebuilt-db9cc925-eb007c37.js
Attempted import error: 'FetchXmlHttpFactory' is not exported from '@firebase/webchannel-wrapper' (imported as 'v').

I have attached package.json just in case.为了以防万一,我附上了 package.json。

{
  "name": "100xhunt",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@babel/core": "^7.13.15",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "axios": "^0.21.1",
    "bootstrap": "^4.6.0",
    "charenc": "0.0.2",
    "crypt": "0.0.2",
    "dotenv": "^9.0.2",
    "firebase": "^8.6.2",
    "gsap": "^3.6.1",
    "jquery": "^3.6.0",
    "jwt-decode": "^3.1.2",
    "lodash": "^4.17.21",
    "lzma": "^2.3.2",
    "pako": "^2.0.3",
    "react": "^17.0.2",
    "react-bootstrap": "^1.6.0",
    "react-datepicker": "^3.8.0",
    "react-device-detect": "^1.17.0",
    "react-dom": "^17.0.2",
    "react-firebaseui": "^5.0.2",
    "react-icons": "^4.2.0",
    "react-redux": "^7.2.3",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "react-select": "^4.3.0",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0",
    "stats-js": "^1.0.1",
    "styled-components": "^5.2.3",
    "three": "^0.94.0",
    "three-css2drender": "^1.0.0",
    "three-obj-loader": "^1.1.3",
    "three-objmtll-loader": "^1.0.1",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ],
  }
}

My project was working fine minutes ago.我的项目几分钟前运行良好。 I will appreciate your help.我会感谢你的帮助。

  1. delete node_modules folder删除node_modules文件夹
  2. delete package-lock.json删除package-lock.json
  3. run npm i to re-install all packages运行npm i重新安装所有软件包
  4. install package @firebase/webchannel-wrapper by npm i @firebase/webchannel-wrapper --save通过 npm i @firebase/webchannel-wrapper 安装 package @firebase/webchannel-wrapper npm i @firebase/webchannel-wrapper --save

hope it works it worked for me希望它对我有用

Had the same problem, and thanks to @Harkal for answering the question, but遇到了同样的问题,感谢@Harkal 回答了这个问题,但是

I didn't delete node module + package-lock.json,我没有删除节点模块+ package-lock.json,

I just ran npm i @firebase/webchannel-wrapper --save我刚刚跑了npm i @firebase/webchannel-wrapper --save

It worked for me just fine它对我有用

I have fixed my problems by installing the old version of the npm package instead of the new version.我通过安装旧版本 npm package 而不是新版本解决了我的问题。 I didn't delete node module + package-lock.json, I have an old version of (npm i html-to-text@7.1.1) installed, instead of new version (npm i html-to-text@8.0.0)我没有删除节点模块 + package-lock.json,我安装了旧版本 (npm i html-to-text@7.1.1),而不是新版本 (npm i html-to-text@8.0. 0)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在 iOS(颤振应用程序)中收到 Firebase AppCheck 错误 - Why am I getting a Firebase AppCheck error in iOS (Flutter app) 尝试使用本机反应和 firebase 登录时出现此错误 - I am getting this error when trying to login using react native and firebase 我在运行我的应用程序时收到此 E/flutter (25055) 错误(Flutter,FireBase - I am getting this E/flutter (25055) error when I am running my App (Flutter , FireBase 从firestore(firebase)获取数据时出现错误。 我正在使用本机反应 - I am getting an error while fetching data from firestore(firebase). I am using react native 为什么在 Google BigQuery 上安排查询时出现错误? - Why am I getting an error when scheduling a query on Google BigQuery? 当我使用 import * as firebase from 'firebase' 导入 firebase 时;? - when I import firebase using import * as firebase from 'firebase';? 为什么我在使用 Compute Engine 时遇到错误 - Why am I getting an error using Compute Engine firebase.database 不是 function 为什么我在反应本机应用程序中收到此错误? - firebase.database is not a function why I am getting this error in react native app? 尝试导入错误:“查询”未从“firebase/firestore”导出 - Attempted import error: 'query' is not exported from 'firebase/firestore' 为什么在将 env 变量加载到 Firebase function 时我得到未定义? - Why am I getting undefined when loading env variables into Firebase function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM