Passport: Unknown authentication strategy "local"

i have done like this and it worked

$npm install passport-local

var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy; /* this should be after passport*/



 passport.use(new LocalStrategy(
  function(username, password, done) {
    User.findOne({ username: username }, function(err, user) {
      if (err) { return done(err); }
      if (!user) {
        return done(null, false, { message: 'Incorrect username.' });
      }
      if (!user.validPassword(password)) {
        return done(null, false, { message: 'Incorrect password.' });
      }
      return done(null, user);
    });
  }
));

You forgot to import passport config file in your app.js.

import passport config after initializing passport.

app.use(passport.initialize());
app.use(passport.session());
// Add the line below, which you're missing:
require('./path/to/passport/config/file')(passport);