rkusa / koa-passport-example

koa-passport usage example
https://github.com/rkusa/koa-passport
262 stars 74 forks source link

Doesn't run "TypeError" exception #9

Closed romu70 closed 8 years ago

romu70 commented 8 years ago

Hi, Trying to run the example and an exception is raised on line 15:

app.use(bodyParser())

Error trace:

TypeError: Support for generators has been removed.

I run Koa2-alpha3.

rkusa commented 8 years ago

Do you have body-parser version 3 installed?

romu70 commented 8 years ago

Obviously no, but I would have expected it would be installed with koa-bodyparser, am I wrong?

body-parser version 3 doesn't exist, the most recent is 1.14.2. Which one should I install?

rkusa commented 8 years ago

Unfortunately not, for koa@2 itself and all compatible middlewares, the NPM latest tag (which is installed with npm install koa-bodyparser) will still install koa@1 (and compatible middleware respectively). Instead, the next tag is used for koa@2 compatible stuff. That is, you could use npm install koa-bodyparser@next.

romu70 commented 8 years ago

Yes, my mistake, sorry, I'm a bit newbie.

I've just install koa-passport@next this also installed koa-bodyparser 2.0.1. Same issue. So, I guess I've to install the body-parser package, but last version is 1.14.2, not 3.

Thanks for your help.

rkusa commented 8 years ago

Sorry I had an error in my previous comment. I mean npm install koa-bodyparser@next and not npm install koa-passport@next. Does this help?

romu70 commented 8 years ago

Much better @rkusa, I still miss some other modules, but I'm going to read a bit more to see which are necessary. Currently, this issue is gone.

rkusa commented 8 years ago

You are welcome. You can also use koa-convert to convert koa@1 middleware to koa@2 middleware.