nodeJS/Express TypeError "passport-authenticate is not a function"

In you app.js file, you have a line that reads like this:

require('passport');

// view engine setup

Check this video link.

He tells you to do:

require('./config/passport');

That could be an issue. I think you want to require your local passport file, the one that’s in D: there.

So maybe try replacing that line with:

require('D:/Other/Projects/Code/Powershell/shopping-cart/config/passport.js');

Let us know what happens.

I replaced the line you mentioned with my path to the passport.js file like you wrote it, but still throws the Route.post() requires a callback function but got [object Object] error

Ah that’s a bummer. I’m sorry I couldn’t fix the problem. However, if you look at the video link, it does indicate that there is at least one error in your code, so maybe there are more… It’s kind of a problem that he doesn’t provide the source code for the “end product”. I guess you’re supposed to follow along, but that’s a lot of copying to do from a video!

1 Like

I agree, in the start he says the idea is to show that you can create this project in a short period of time. What I don’t understand is why his code works when he tries to start the server, and why mine doesn’t, when I copied everything he did. I guess I have to find another guide, thanks alot for your time and help

Well, he was clearly pointing to the passport file in the config directory, whereas you were using the passport library file - it’s easy to make a mistake like that. So you made an error in trying to transcribe his video content there. It’s possible there are more errors like that. Even a tiny error can break everything.
Good luck!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.