Cannot find module 'hbs', express-handlebars Cannot find module 'hbs', express-handlebars express express

Cannot find module 'hbs', express-handlebars


According to the express-handlebars documentation, you have to setup and register the view engine manually:

var express = require('express');var exphbs  = require('express-handlebars');var app = express();var hbs = exphbs.create({ /* config */ });// Register `hbs.engine` with the Express app.app.engine('handlebars', hbs.engine);app.set('view engine', 'handlebars');// ...still have a reference to `hbs`, on which methods like `loadPartials()`// can be called.

Looking a little bit further down in the documentation, looks like you can still use the .hbs extension with a bit of configuration:

var express = require('express');var exphbs  = require('express-handlebars');var app = express();app.engine('.hbs', exphbs({extname: '.hbs'}));app.set('view engine', '.hbs');


use command -- sudo npm link hbs


you might have named the main folder as "express"just change the name of folder,delete "package.json" and try"npm install" again and then "npm install express""npm install hbs"