简体   繁体   English

意外令牌导出 firebase-app.js:1590

[英]unexpected token export firebase-app.js:1590

I am trying firebase web for first time, i was following the documentation still code isn't working and giving this "unexpected token 'export' " error in console.我第一次尝试 firebase web,我按照文档仍然代码不起作用并在控制台中给出了这个“意外的令牌'导出'”错误。 code:代码:

<!DOCTYPE html>
<html>
<head>
    <title> Firebase Demo </title>
    <script src="https://www.gstatic.com/firebasejs/9.0.2/firebase-app.js"/>
    <script src="https://www.gstatic.com/firebasejs/9.0.2/firebase-auth.js"/>
    <script src="https://www.gstatic.com/firebasejs/9.0.2/firebase-database.js"/>
    <script>
        const firebaseConfig = {
          #firebase config info
        };

        // Initialize Firebase
        const app = firebase.initializeApp(firebaseConfig);

        const database = firebase.database();
        database.ref("List/"+"Targets").set({
            name:"niel",
            state:"alive"
        });
    </script>
</head>
<body>
<h1 align="center">Firebase Jinx</h1>
</body>
</html>

please help, thank you请帮忙,谢谢

The v9 SDKs are shipped as JavaScript modules by default.默认情况下,v9 SDK 以 JavaScript 模块的形式提供。 To use them in a regular JavaScript import, and to use your style of code, you can instead import the compatibility layer as shown in the documentation on using the compat library from your window :要在常规 JavaScript 导入中使用它们,并使用您的代码风格,您可以导入兼容层,如有关使用 window 中的兼容库的文档中所示:

<script src="https://www.gstatic.com/firebasejs/9.0.2/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.2/firebase-firestore-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.2/firebase-auth-compat.js"></script>

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

相关问题 运行 firebase 部署时,在 flutter 应用程序上 1:1 时解析错误意外令牌 '��' - Parse error Unexpected token '�' at 1:1 ��{ on flutter app when running firebase deploy firebase 存储:在“firebase/app”中找不到导出“存储”(导入为“firebase”) - firebase storage: export 'storage' (imported as 'firebase') was not found in 'firebase/app' firebase 存储:在“firebase/app”中找不到导出“存储”(导入为“firebase”)继续 - firebase storage: export 'storage' (imported as 'firebase') was not found in 'firebase/app' Continuation Firebase 云函数部署错误 - SyntaxError: Unexpected token '?' - Firebase Cloud Functions Deploy Error- SyntaxError: Unexpected token '?' 将 js-cookie 值设置为 firebase 令牌 - set js-cookie value to firebase token 尝试导入错误:“firebase/app”不包含默认导出(导入为“firebase”) - Attempted import error: 'firebase/app' does not contain a default export (imported as 'firebase') Firebase 用户导入/导出 - Firebase user import / export Firebase 覆盖现有令牌 - Firebase override existing token Firebase 云消息令牌 - Firebase Cloud Messaging Token 从 Node js 调用 Flutter web 应用程序 function ZBF12E1515C25C7D8A15AB2F14Z13 - Call Flutter web app from Node js function firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM