Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!