cannot find module 'passport-local' error

am using passport in node.js

in my app.js

var passport = require('passport')

require('./config/passport').boot(passport, config)

in passport.js

var LocalStrategy = require('passport-local').Strategy

run the app and i get this error message

    throw err;

error:Cannot find module 'passport-local'
      at Object.<anonymous> <F:\work\config\passport.js:2:21>

i install the passport in F:\work\node_modules.

even if i put the

 var LocalStrategy = require('passport-local').Strategy

right under the

 var passport = require('passport')

i still get the same error

any idea why?


Have you installed passport-local module?

npm install passport-local

I had the same problem and I solved it:

Check your package.json file. If it does not exist, you need to init your project in the same folder where you wrote your main JS file (server.js or index.js or however you want).

$ sudo npm init 

and when installing npm modules, remeber to save them in package file:

$ sudo npm install passport-local --save 

I solved in this way.

Need Your Help

How to access to a property defined in file?

grails groovy properties internationalization multilingual

I have a Groovy Grails application and I want to access programmatically to a property defined in

getCheckedRadioButtonId() returning useless int?

android android-layout onclick

I have a button's onClickListener that needs to detect which radiobutton was selected when the user clicks the button. Currently, the Log.v you see below in the onClickListener is not returning a u...