Error: Unknown authentication strategy "local" (Express & Passport)
<p>I'm trying to use passport authentication within express app.</p>

<pre><code>router.get('/signup', (req ,res) =&gt; {
  res.render('signup');
});

router.post('/signup', function(req, res, next) {
  var username = req.body.username;
  var password = req.body.password;

  User.findOne({ username: username }, function(err, user) {

    if(err) { return next(err); }
    if(user) {
      req.flash('error', 'User already exists');
      return res.redirect('/signup');
    }

    var newUser = new User({
      username: username,
      password: password
    });
    newUser.save(next);
  });
}, passport.authenticate('local', {
  successRedirect: '/',
  failureRedirect: '/signup',
  failureFlash: true
}));
</code></pre>

<p>Every time I try to sign up test user, it works but it shows me an error like this:</p>

<pre><code>Error: Unknown authentication strategy "local"
</code></pre>

<p>Can you advise me something.</p>