koajs / bodyparser

Koa body parsing middleware
MIT License
1.31k stars 116 forks source link

Async Function Error #84

Closed du5rte closed 7 years ago

du5rte commented 7 years ago

Came across this error, when I changed my node version from development 8.3.0 to production 6.11.2. I'm guessing I think I already have async function support. Maybe a good way to overcome this is have the code transpiled with babel using babel-preset-env so you get a custom installation depending on your node version?

...\node_modules\koa-bodyparser\index.js:72
  return async function bodyParser(ctx, next) {
               ^^^^^^^^
SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Module._extensions..js (module.js:579:10)
    at Object.require.extensions.(anonymous function) [as .js] (...\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
[nodemon] app crashed - waiting for file changes before starting...
dead-horse commented 7 years ago

only support for node 7.6+, or you must configure your babel to compile node_modules/koa-bodyparser