thigi thigi - 1 year ago 103
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){

Answer Source

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');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download