问题
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