我刚开始学习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);