nodejs: Cannot find module 'passport'

Adding a new module to your package.json won't actually include the dependency in the repository. You'll need to either run npm install after adding dependencies to package.json, or you can install packages using something like npm install <package name>. In this case, you'd want npm install passport.

npm install will download the source from npm and put it into the ./node_modules directory.

npm install documentation


Change:

import passport = require("passport");

to:

var passport = require("passport");