SimplyBuilt/hubot-github-issue-lookup

New to hubot Question

Closed this issue · 6 comments

miklb commented

I'm attempting to use this with the IRC adapter and failing (I do have hubot with irc working through a Heroku deploy)

The instructions do not mention adding the package to external-scripts.json nor does it mention installing githubot

I've tried several different combinations of the above and generally wind up with an error

ERROR Error loading scripts from npm package - TypeError: require(...) is not a function
  at Robot.loadExternalScripts (/Users/me/Dev/myhubot/node_modules/hubot/src/robot.coffee:401:11, <js>:272:39)
  at /Users/me/Dev/myhubot/node_modules/hubot/bin/hubot:152:11, <js>:159:26
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)

Any tips greatly appreciated

@miklb this bug was introduced in 1.0.0. I bisected this and determined that commit 08f0f19 is at fault.

I did some further digging - this problem is caused by this change in index.babel.js:

 const IGNORED = (process.env.HUBOT_GITHUB_ISSUE_LINK_IGNORE_USERS || '').split(',');

-module.exports = (robot) => {
+export default (robot) => {
     if (TOKEN == undefined || REPO == undefined){
         console.warn("Missing HUBOT_GITHUB_TOKEN and/or HUBOT_GITHUB_REPO");
         return;
miklb commented

Thanks @strugee good to know.

As to the question about adding to the external-scripts.json file, should this package be in that file?

And as I said, very new to how node modules work, does it install dependencies and not needed to be done by user? I'll gladly send a pull request to update the docs with the clarification for beginners like myself.

@miklb you need to install this module by yourself. Then, to tell Hubot to load it, you add it to external-scripts.json.

I'd suggest taking a look at the "Getting Started" section of https://docs.npmjs.com/. That should give you a good start understanding how Node.js/npm tracks dependencies :)

miklb commented

@strugee I have a working bot, and all of the other packages include the instructions to add the package to external-scripts.json, this one doesn't, which is why I asked to clarify. I do have experience with package managers, just not much with npm, other than installing a few here and there. This is my first real foray into building something.

Thanks for the link to the docs, I certainly will dig in as time allows.

Pull request sent to add that to the Readme.md file.

@MikiB no problem, and good luck!