thigi thigi - 5 months ago 38
Node.js Question

Express NodeJS Cannot find module 'html'

I have a Node Server with Express. I get the cannot find module 'html' error even though my code looks like this and should be correct in my opinion:

app.set('views', path.join(__dirname, 'build/views'));
app.use(favicon(path.join(__dirname, "build/favicon.ico")));
app.use('/scripts', express.static(path.join(__dirname, 'node_modules')));
app.use(express.static(path.join(__dirname, 'build')));

app.get('/', function(req, res){


You have to set engine for HTML

Include this code in your main file

var engines = require('consolidate');

app.engine('html', engines.mustache);
app.set('view engine', 'html');