title: nodejs handlebars: 'TypeError: this.engine is not a function'
body: <p>I try to use handlebars template in Express. I get this Error-Message:</p>
  
  <blockquote>
    <p>TypeError: this.engine is not a function
        at View.render (/home/ubuntu/workspace/node_modules/express/lib/view.js:128:8) ...</p>
  </blockquote>
  
  <p>with this code:</p>
  
  <pre><code>'use strict';
  
  var express = require('express');
  var expressHandlebars  = require('express-handlebars');
  
  var app = express();
  
  app.engine('handlebars', expressHandlebars({defaultLayout: 'layout'}));
  app.set('view engine', 'html');
  app.use(express.static('views'));
  
  app.route('/single/:id')
      .get(function (req, res) {
          res.render(process.cwd() + `/public/single-poll`, {
              id: req.params.id
          });
      });
  
  app.listen(process.env.PORT,  function () {
      console.log('Node.js listening on port ' + process.env.PORT + '...');
  });
  </code></pre>
  
  <p>When I replace the render() function with sendFile() is works fine. I'm aware of <a href="https://stackoverflow.com/questions/43676188/express-js-render-typeerror-this-engine-is-not-a-function">Express js render : TypeError: this.engine is not a function</a> and <a href="https://stackoverflow.com/questions/43361109/express-js-render-error-this-engine-is-not-a-function">Express js render error this.engine is not a function</a> and <a href="https://stackoverflow.com/questions/40934450/typeerror-this-engine-is-not-a-function-when-trying-to-use-moustache-in-express">TypeError: this.engine is not a function when trying to use Moustache in Express JS</a>, but they didn't help for me.</p>
  
  <p>What can be the problem?</p>