为什么要求koa会导致错误

时间:2017-03-13 09:44:26

标签: koa

我刚开始学习node.js,当我需要koa并执行"node app.js"

有错误。谁能帮我解释一下? 以及如何解决它?

日志:

/home/leon/Learn/JS/crawler/node_modules/koa/lib/response.js:47
    const { res } = this;
          ^
    SyntaxError: Unexpected token {
        at exports.runInThisContext (vm.js:53:16)
        at Module._compile (module.js:387:25)
        at Object.Module._extensions..js (module.js:422:10)
        at Module.load (module.js:357:32)
        at Function.Module._load (module.js:314:12)
        at Module.require (module.js:367:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/home/leon/Learn/JS/crawler/node_modules/koa/lib/application.js:11:18)
        at Module._compile (module.js:413:34)
        at Object.Module._extensions..js (module.js:422:10)

代码:

var koa = require('koa');    
var app = koa();    
app.listen(3000);

0 个答案:

没有答案