Home > Software design >  TypeError: hbs is not a function
TypeError: hbs is not a function

Time:12-08

I was doing a nodejs based project using express and when I was adding partials to the app.js file. i got a type error :"TypeError: hbs is not a function". i installed npm express-handlebars module. then also showing error again. how to fix it. i also add this code: 'var hbs=require('express-handlebars');'enter image description here

this is my code:

app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'hbs'); app.engine('hbs', hbs({extname: 'hbs', defualtLayout : 'layout' , layoutsDir: __dirname '/views/layouts',partialsDir:__dirname '/views/partials/'}));

CodePudding user response:

Looking at the documentation, it doesn't look that you are initializing it in the right way cf.https://www.npmjs.com/package/express-handlebars

  • Related