CoffeeScript: ImapConnection is not defined in node-imap

青春壹個敷衍的年華 提交于 2020-01-05 04:58:14

问题


I am trying to run example Coffee Scripts from: CoffeScript and node-imap

Sending messages works fine, but when I attempt to read a message, I got this kind of error:

TypeError: imap.ImapConnection is not a function
  at Object.<anonymous> (/home/rmatuszak/Dokumenty/NodeJS/mail/coffee2/read.coffee:15:14)
  at Object.<anonymous> (/home/rmatuszak/Dokumenty/NodeJS/mail/coffee2/read.coffee:7:1)
  at Module._compile (module.js:409:26)
  at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:134:23)
  at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
  at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
  at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
  at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:7:41)
  at Module._compile (module.js:409:26)
  at Object.Module._extensions..js (module.js:416:10)
  at Module.load (module.js:343:32)
  at Function.Module._load (module.js:300:12)
  at Function.Module.runMain (module.js:441:10)
  at startup (node.js:139:18)
  at node.js:968:3

On the homepage of this gist someone mentioned about this issue, but didn't get answer. Did anyone had issue like that?


回答1:


I got it ;) according to this link, I realized, that I have to create a new imap object using server = new imap as it was declared in the beggining of script.



来源:https://stackoverflow.com/questions/38351949/coffeescript-imapconnection-is-not-defined-in-node-imap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!