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

188
Visualizações
I can't import Bootstrap in my NPM project

I'm trying to import bootstrap through the npm console, but I don't know how to connect the packages with my project. I've tried to import it in my index.mjs like this: import 'bootstrap', but the console drop me an error saying: Reference error: document is not defined. I'm using Handlebars engine. Thanks!

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

0

I'm going to assume that you're trying to add bootstrap to a server-rendered page that uses handlebars as its templating engine.

Inside your server page, I'm going to call it app.js you should add the following two lines:

app.use('/css', express.static(path.join(__dirname, 'node_modules/bootstrap/dist/css')));
app.use('/js', express.static(path.join(__dirname, 'node_modules/bootstrap/dist/js')));

Then in your master page, and I'm going to call it layout.hbs you would add these references:

<link rel="stylesheet" href="./css/bootstrap.min.css" />
<script src="./js/bootstrap.bundle.js"></script>

Once you have those lines of code in those files, you should now have bootstrap and its accompanying JavaScript files ready for use by your HTML elements.

Good luck and hope this helps you out.

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