Skip to content

TypeError: require(...) is not a function #5

@antn

Description

@antn

Hello! First off, shouts out for working on chatops rpc, it's sooo nice to be able to use this instead of writing coffeescript! ✨

When trying to use this package, I kept getting an error:

Hubot> [Sun Apr 22 2018 20:41:03 GMT-0700 (PDT)] ERROR Unable to load /Users/antn/code/bffs-hubot/node_modules/hubot-chatops-rpc/src/chatops-rpc: TypeError: require(...) is not a function
  at Object.<anonymous> (/Users/antn/code/bffs-hubot/node_modules/hubot-chatops-rpc/src/chatops-rpc.coffee:15:11, <js>:8:32)
  at Object.<anonymous> (/Users/antn/code/bffs-hubot/node_modules/hubot-chatops-rpc/src/chatops-rpc.coffee:13:1, <js>:509:4)
  at Module._compile (module.js:649:30)
  at Object.loadFile (/Users/antn/code/bffs-hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:182:19)
  at Module.load (/Users/antn/code/bffs-hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
  at tryModuleLoad (module.js:501:12)
  at Function.Module._load (module.js:493:3)
  at Module.require (module.js:593:17)
  at require (internal/module.js:11:18)
  at Robot.loadFile (/Users/antn/code/bffs-hubot/node_modules/hubot/src/robot.coffee:355:9, <js>:224:20)
  at module.exports (/Users/antn/code/bffs-hubot/node_modules/hubot-chatops-rpc/index.coffee:11:9, <js>:24:31)
  at Robot.loadExternalScripts (/Users/antn/code/bffs-hubot/node_modules/hubot/src/robot.coffee:401:11, <js>:272:39)
  at /Users/antn/code/bffs-hubot/node_modules/hubot/bin/hubot:152:11, <js>:159:26
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:532:3)

It appears to be this line:

timeAgo = require("time-ago")()

I was able to fix this by removing the () after the require, and everything seems to be working still. I don't know enough about coffeescript to know if this is a real solution though. 🙇‍♀️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions