Search code examples
node.jsexpresstemplate-enginehbs

Cannot find module 'hbs', Handlebars template engine


I don't know why it gives this error. I have also set view engine to hbs using app.set(), also defined path of views (path is correct, no error there). But it still says cannot find module hbs (it is already installed) when I try to render.

You can see that I am using get() request to render() the index.hbs file inside Views folder. Why is it showing this error? enter image description here


Solution

  • ....It's somewhat silly of me, but it was because of another node_modules outside the project directory ExpressProject. You can see that there is another node_modules(in the bottom) outside ExpressProject. But what I don't get here now, is that why is the outer node_module affecting ExpressProjectdirectory?

    It has it's own node_modules, and I am also running the server from ExpressProject directory, not from outside of it.