Closed Penggggg closed 7 years ago
Problem: I start up app.js with babel-node, but when I import 'body-parser', an error throw: /koa-bodyparser/index.js:69 return async function bodyParser(ctx, next) { SyntaxError: Unexpected token function Package.json: "dependencies": { "koa": "^2.0.1", "koa-bodyparser": "^4.1.0", "koa-logs-full": "0.0.8", "koa-router": "^5.4.0", "koa-static-cache": "^4.0.0", "superagent": "^3.5.0" }, "devDependencies": { "babel-cli": "^6.23.0", "babel-loader": "^6.3.2", "babel-plugin-transform-async-to-generator": "^6.22.0", "babel-preset-es2015": "^6.22.0", "babel-preset-stage-0": "^6.22.0" } .babelrc: { "presets": [ "stage-0", "es2015" ], "plugins": [ "transform-async-to-generator" ] }
node 7.6+ required
Problem: I start up app.js with babel-node, but when I import 'body-parser', an error throw: /koa-bodyparser/index.js:69 return async function bodyParser(ctx, next) { SyntaxError: Unexpected token function Package.json: "dependencies": { "koa": "^2.0.1", "koa-bodyparser": "^4.1.0", "koa-logs-full": "0.0.8", "koa-router": "^5.4.0", "koa-static-cache": "^4.0.0", "superagent": "^3.5.0" }, "devDependencies": { "babel-cli": "^6.23.0", "babel-loader": "^6.3.2", "babel-plugin-transform-async-to-generator": "^6.22.0", "babel-preset-es2015": "^6.22.0", "babel-preset-stage-0": "^6.22.0" } .babelrc: { "presets": [ "stage-0", "es2015" ], "plugins": [ "transform-async-to-generator" ] }