简体   繁体   English

React JS,Firebase,TypeError:无法读取未定义的属性“initializeApp”

[英]React JS, Firebase, TypeError: Cannot read property 'initializeApp' of undefined

Everything works fine until I install "npm install react-transition-group --save".一切正常,直到我安装“npm install react-transition-group --save”。 Then somehow I got this "TypeError: Cannot read property 'initializeApp' of undefined" error.然后不知何故,我得到了这个“TypeError:无法读取未定义的属性'initializeApp'”错误。

Very similar to this post, but I still can't get it to work. 与这篇文章非常相似,但我仍然无法让它工作。

I also tried reinstall all the package, didn't work as well.我还尝试重新安装所有 package,但效果不佳。

我得到的错误。

Here is my firebase config file.这是我的 firebase 配置文件。

import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/storage';

const firebaseConfig = {
  apiKey: "XXX",
  authDomain: "XXX",
  projectId: "XXX",
  storageBucket: "XXX",
  messagingSenderId: "XXX",
  appId: "XXX"
}

firebase.initializeApp(firebaseConfig);

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

Does anyone know what went wrong?有谁知道出了什么问题? Thanks a lot for any help!非常感谢您的帮助!

I have already solved the issues, it is due to after ruining "npm audit-force", it changed some of the packages' version in the package.json.我已经解决了这些问题,这是由于在破坏“npm audit-force”之后,它改变了 package.json 中的一些包版本。 After I compared the version numbers from the github repository, and changed them to the correct version, then run npm install.在我比较了 github 存储库中的版本号并将它们更改为正确的版本之后,然后运行 npm 安装。 It solved the problem.它解决了这个问题。

暂无
暂无

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

相关问题 Next.js、Firebase、未处理的运行时错误 - TypeError:无法读取未定义的属性“initializeApp” - Next.js, Firebase, Unhandled Runtime Error - TypeError: Cannot read property 'initializeApp' of undefined 未捕获的类型错误:无法读取未定义的属性“initializeApp” - Uncaught TypeError: Cannot read property 'initializeApp' of undefined 在 Firebase 中,我收到 Uncaught TypeError: Cannot read property 'initializeApp' of undefined,但不确定为什么未定义“firebase”? - In Firebase I am getting an Uncaught TypeError: Cannot read property 'initializeApp' of undefined, but not sure why 'firebase' is not defined? TypeError:无法读取react js中未定义的属性“then” - TypeError: Cannot read property 'then' of undefined in react js 我有一个类型错误:无法读取未定义的属性“GoogleAuthProvider”?(React JS)Firebase? - I am having a TypeError: Cannot read property 'GoogleAuthProvider' of undefined?(React JS) Firebase? 类型错误:无法读取未定义的 Firebase 存储反应的属性“ref” - TypeError: Cannot read property 'ref' of undefined Firebase-storage react React&Firebase-未捕获的TypeError:无法读取未定义的属性'setState' - React & firebase- uncaught TypeError: Cannot read property 'setState' of undefined TypeError:无法读取未定义节点 Js firebase 函数的属性“修剪” - TypeError: Cannot read property 'trim' of undefined Node Js firebase functions 错误 - 无法读取未定义的属性“initializeApp” - Error - Cannot read property 'initializeApp' of undefined React js TypeError:无法读取未定义的属性“地图” - React js TypeError: Cannot read property 'map' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM