TypeError: object is not a function - github passport setup

TypeError: object is not a function - github passport setup

我正在尝试使用护照为 github 设置 oauth 策略。同样的设置适用于设置 Twitter 策略。认为我犯了一个简单的 javascript 错误,但不确定在哪里。

var  passport = require('passport'),
     GithubStrategy = require('passport-github'),
     config = require('./config/oauth.js');

passport.use(new GithubStrategy({
    clientID: config.github.clientID,
    clientSecret: config.github.clientSecret,
    callbackURL: config.github.callbackURL
    },
    function(accessToken, refreshToken, profile, done) {
        process.nextTick(function () {
            return done(null, profile);
        });
    }
));

这是我得到的错误堆栈;

passport.use(new GithubStrategy({
         ^
TypeError: object is not a function
    at Object.<anonymous> (/Users/Kevin/gd/proj/priv/Vebulid/app.js:42:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/Kevin/gd/proj/priv/Vebulid/bin/www:7:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

您需要使用 .Strategy 属性:

var GithubStrategy = require('passport-github').Strategy;