2014-11-26 4 views
0

어디서 왔는지 모르겠지만 CO 4.0 버전이 설치되었고 0.11.14 버전의 노드가 있습니다."TypeError : 객체가 함수가 아닙니다."

/home/tbrown/.nvm/current/bin/node --debug-brk=23342 --nolazy 
--harmony routes-to-apache-reverse-proxy.js Debugger listening on port 23342 THIS IS LOGGED /home/Documents/projects/server/routes/routes-to-apache-reverse-proxy.js:8 co(main)() 
     ^TypeError: object is not a function 
    at Object.<anonymous> (/home/Documents/projects/server/routes/routes-to-apache-reverse-proxy.js:8:9) 
    at Module._compile (module.js:460:26) 
    at Object.Module._extensions..js (module.js:478:10) 
    at Module.load (module.js:355:32) 
    at Function.Module._load (module.js:310:12) 
    at Module.runMain [as _onTimeout] (module.js:501:10) 
    at Timer.listOnTimeout (timers.js:133:15) 

Process finished 

with exit code 1 

가 참조하는 라인이

co(main)() 

답변

2

이다 : 3.1 일 아주 간단한 코드는

"use strict" 
const co = require('co') 

const main = function*() { 
    console.log('THIS IS LOGGED') 
} 

co(main)() 

날이 출력을 제공합니다 (단지 공동의 이전 버전이 다른주의) 확인 CO가 3-> 4에서 바뀌 었습니다. - 이것은 동일하게 보입니다.

"use strict" 
const co = require('co') 

const main = function*() { 
    console.log('THIS IS LOGGED') 
} 

co(main). 
    catch(function(e){ 
     console.error(e) 
    }) 
관련 문제