带节点的Firebase,“以浏览器为目标的Firebase捆绑包”

问题描述 投票:1回答:1

我获得了Node的npm“ firebase”软件包,制作了firebaseConfig.js文件,然后添加了此文件:

const firebase = require("firebase/app");
console.log(firebase);

const firebaseConfig = {
 ...
};

firebase.initializeApp(firebaseConfig);

[起初,我收到一个错误消息:“ initializeApp不是函数”,看到firebase的内容后,我将最后一行更改为]]

firebase.default.initializeApp(firebaseConfig);

哪个工作,但现在我在控制台上收到此警告;

      Warning: This is a browser-targeted Firebase bundle but it appears it is being
      run in a Node environment.  If running in a Node environment, make sure you
      are using the bundle specified by the "main" field in package.json.

我真的不明白我应该在这里做什么,我真的可以使用一些指导,所以在此先多谢!

我为Node获得了npm“ firebase”软件包,创建了一个firebaseConfig.js文件,然后添加了以下内容:const firebase = require(“ firebase / app”); console.log(firebase); const firebaseConfig = {...}; ...

node.js firebase express firebase-storage
1个回答
0
投票

[在服务器端使用firebase时,应使用firebase-admin。

© www.soinside.com 2019 - 2024. All rights reserved.