iojs运行文件时报错

jike_6635662 基于 Node.js 平台的下... 04月01日提问

  • 0 回答
  • 176 浏览

文件:koa.js

var koa = require('koa');

var app = koa();

app.use(function * (){

    this.body='hello world';

});

app.listen(3000);

执行 iojs koa.js,报错如下:

[root@localhost koa]# iojs koa.js 

/home/koa/node_modules/koa/lib/application.js:61

  listen(...args) {

         ^^^

SyntaxError: Unexpected token ...

    at exports.runInThisContext (vm.js:53:16)

    at Module._compile (module.js:413:25)

    at Object.Module._extensions..js (module.js:448:10)

    at Module.load (module.js:355:32)

    at Function.Module._load (module.js:310:12)

    at Module.require (module.js:365:17)

    at require (module.js:384:17)

    at Object.<anonymous> (/home/koa/koa.js:1:73)

    at Module._compile (module.js:430:26)

    at Object.Module._extensions..js (module.js:448:10)