Co.js app报告“TypeError:无法调用方法'应用'未定义”

时间:2014-03-02 09:59:19

标签: ecmascript-harmony koa

当我尝试运行我的Co.app时,我得到了

TypeError: Cannot call method 'apply' of undefined
    at /home/ecarroll/code/chrome-okc-plugin/node_modules/thunkify/index.js:32:8
    at /home/ecarroll/code/chrome-okc-plugin/test.js:12:17
    at GeneratorFunctionPrototype.next (native)
    at next (/home/ecarroll/code/chrome-okc-plugin/node_modules/co/index.js:70:21)
    at /home/ecarroll/code/chrome-okc-plugin/node_modules/co/index.js:50:5
    at Object.<anonymous> (/home/ecarroll/code/chrome-okc-plugin/test.js:13:4)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)

1 个答案:

答案 0 :(得分:0)

这个错误是你对未定义的东西进行thunkify的结果,比如这个......

var readdir = thunkify(readdir);

当你想要的时候,

var readdir = thunkify(fs.readdir);