0

TypeError: hbs is not a function at Object. (D:\Brototype\Web Development Challenge-2\shopping-cart\app.js:17:19) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Module.require (node:internal/modules/cjs/loader:1143:19) at require (node:internal/modules/cjs/helpers:119:18) at Object. (D:\Brototype\Web Development Challenge-2\shopping-cart\bin\www:7:11) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)

Node.js v18.18.0 [nodemon] app crashed - waiting for file changes before starting... -------------------------------------This is my app.js code Why showing this error while i already installed express-handlebars and connect engin in app.js

I try to run my code in terminal but It shoing error. I need to run my server and check output on browser

2

1 Answer 1

0

Your usage of handlebars is not correct. You need to call the hbs.engine function instead like so:

app.engine("hbs", hbs.engine({
   extname: "hbs",
   defaultLayout: "layout",
   //...
}));

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.