Closed chenguose closed 7 years ago
node 版本是 v7.6.0+ 吗?
我的node版本v6.10.3;
knbdeMacBook-Pro:koa-grace knb$ npm run dev
> gracejs@2.0.10 dev /Users/knb/workspace/github/koa-grace
> nodemon bin/server.js
[nodemon] 1.11.0
[nodemon] reading config /Users/knb/workspace/github/koa-grace/nodemon.json
[nodemon] to restart at any time, enter `rs`
[nodemon] ignoring: /Users/knb/workspace/github/koa-grace/.git/**/* .nyc_output .sass-cache bower_components coverage /Users/knb/workspace/github/koa-grace/node_modules/**/* /Users/knb/workspace/github/koa-grace/.git/**/* node_modules/**/node_modules
[nodemon] watching: app/*/controller/**/* app/*/model/**/* app/*/mock/**/*
[nodemon] watching extensions: js,json
[nodemon] starting `node bin/server.js`
[nodemon] child pid: 6148
[nodemon] watching 342 files
/Users/knb/workspace/github/koa-grace/middleware/body/index.js:51
return async function body(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 Object.Module._extensions..js (module.js:579:10)
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)
at fs.readdirSync.forEach (/Users/knb/workspace/github/koa-grace/middleware/index.js:9:21)
at Array.forEach (native)
at Object.<anonymous> (/Users/knb/workspace/github/koa-grace/middleware/index.js:6:25)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
[nodemon] app crashed - waiting for file changes before starting...
运行环境readme 应该说明下,即使没测试哪些环境运行,至少将自己的环境贴出来,跑不起来;
注意:请确保你的运行环境中Nodejs的版本至少是v7.6.0 (或者你也可以考虑支持 Nodejs v4.x+ 的koa-grace v1.x)
快速开始的第一行有注明
const { res } = this; ^
SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:405:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (G:\html5\Koa\koa-grace\node_modules\koa\lib\application.js:11:18)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (G:\html5\Koa\koa-grace\src\app.js:4:13)
at Module._compile (module.js:398:26)