lmarkus/hubot-conversation

Cannot set property 'startDialog' of undefined

svict4 opened this issue · 6 comments

hubot> [Sun Nov 22 2015 10:22:11 GMT+1000 (E. Australia Standard Time)] ERROR Error loading scripts from npm package -
 TypeError: Cannot set property 'startDialog' of undefined
  at Conversation (C:\Users\Simon\Documents\hubot\node_modules\hubot-conversation\lib\index.js:36:22)
  at Robot.loadExternalScripts (C:\Users\Simon\Documents\hubot\node_modules\hubot\src\robot.coffee:399:11)
  at C:\Users\Simon\Documents\hubot\node_modules\hubot\bin\hubot:128:26
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

The line in question:

this.startDialog = function startDialog(msg, timeout) {

I guess you're invoking this incorrectly? Might just be me being silly.

Any chance you're not using the "new" keyword when instantiating a Conversation?
eg:

var conversation = new Conversation(robot)

Take a look at the unit tests. npm test should be passing for all of them.

Hmm I removed all of the scripts I had and simply npm installed, giving the above error.
I think there's a clash with another package which I'm investigating now.

You're right though npm test passes and it works fine for a completely new hubot repo.

Welp, I was being dumbdumb and adding "hubot-conversation" to external-scripts.json when it was not needed. Crisis averted.

¯_(ツ)_/¯

Just FYI, I ran into this also, might be worthy of a reminder to NOT do that towards the top of README.md. Just to help us out when we're not thinking. :)

Done :)