koa2在node6下运行

{
    "babel-core": "^6.24.1",
    "babel-plugin-syntax-async-functions": "^6.13.0",
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-polyfill": "^6.23.0",
    "babel-preset-es2015-node6": "^0.4.0",
    "babel-register": "^6.24.1"
}
var babelrc = {
    "presets": ["node6"],
    "plugins": [
        "transform-class-properties",
        "transform-async-to-generator"
    ]
}
require("babel-core/register")(babelrc);

require("./app.js");

koa-bodyparser 报错SyntaxError: Unexpected token function

解决方案:https://github.com/koajs/bodyparser/tree/3.x

koa1使用 npm install koa-bodyparser@2
koa2使用 npm install koa-bodyparser@3

koa-jwt 报错SyntaxError: Unexpected token function

解决方案:https://github.com/koajs/jwt

koa1使用 npm install koa-jwt@1
koa2并且node< 7.6 使用 npm install koa-jwt@2.
koa2并且node>= 7.6 使用 npm install koa-jwt@3.

相关文章:

  • 2021-08-23
  • 2021-12-28
  • 2021-12-27
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-09-25
猜你喜欢
  • 2021-06-07
  • 2021-12-15
  • 2022-12-23
  • 2022-01-14
  • 2021-06-04
  • 2022-01-08
  • 2021-08-24
相关资源
相似解决方案