[英]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.