Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
Uncaught TypeError while importing from firebase/database

error that i'm getting:

Uncaught TypeError: Failed to resolve module specifier "firebase/database". Relative references must start with either "/", "./", or "../".

i am trying to setup firebase configuration for the latest version of firebase 9.1

<script type="module">

    import { initializeApp } from "https://www.gstatic.com/firebasejs/9.1.0/firebase-app.js";
  
    const firebaseConfig = {
        apiKey: "...",
        authDomain: "...",
        databaseURL: "...",
        projectId: "...",
        storageBucket: "...",
        messagingSenderId: "....",
        appId: "..."
    };

    // Initialize Firebase
    const app = initializeApp(firebaseConfig);
    
    //below import statement is causing the error
    import { getDatabase, ref, set } from "firebase/database";

    const db = getDatabase();
    
    </script>

 <script type="text/javascript" >

            function InsertData() {
                set(ref(db, 'TheStudent/'+rollV), {
                    NameOfStudent: "abc",
                    RollNo: 13,
                    Section: "B",
                    Gender: "Male"
                });
            }

            document.getElementById('insertBtn').onclick = InsertData;
</script>

PS. i have hidden the config on purpose, so thats not the problem.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It seems you are using Firebase SDK over CDN so try importing database in same way:

import { getDatabase, ref, set } from "https://www.gstatic.com/firebasejs/9.1.0/firebase-database.js";
// CDN URL instead of "firebase/database"
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda