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

222
Views
Unable to set up handlebars due to : TypeError: handlebars is not a function
const express = require('express');
const app = express();

//set up handlebars
const handlebars = require('express-handlebars');
app.engine("handlebars",handlebars())
app.set("view engine", "handlebars")


const sqlite3 = require('sqlite3');
const sqlite = require('sqlite');

const port = 8080

const dbPromise = sqlite.open({

    filename:"./database/sakila.sqlite",
    driver: sqlite3.Database
})


app.get("/",(req,res)=>{

  
    res.render("home",{layout:false});

})


app.listen(port,()=>{

    console.log(`server running on ${port}`);


})

I was following a lecture video to learn about handlebars. I typed the same code word by word to set up handlebars and I did npm install express-handlebars --save. The instructor's code is working but mine is not. It only warns me that

"app.engine("handlebars",handlebars()) ^

TypeError: handlebars is not a function

" I couldn't figure out why. Please help. Thank you in advance.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const express = require("express");
const handlebars = require("express-handlebars");
const app = express();

//set up handlebars

app.engine("handlebars", handlebars());
app.set("view engine", "handlebars");

const sqlite3 = require("sqlite3");
const sqlite = require("sqlite");

const port = 8080;

const dbPromise = sqlite.open({
  filename: "./database/sakila.sqlite",
  driver: sqlite3.Database
});

app.get("/", (req, res) => {
  res.render("home", { layout: false });
});

app.listen(port, () => {
  console.log(`server running on ${port}`);
});
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!