I use hubot (specifically hubot-hipchat) and want to use the https://github.com/scriby/asyncblock node module . What is the correct way to import / use a node module in hubot?
I cd where I installed hubot (~ / hubot) and did
Edit hubot / packages.json added hubot-hipchat, asyncblock to the dependency section.
"dependencies": {
"hubot-hipchat": ">= 1.0.4",
"hubot": "2.1.4",
"hubot-scripts": ">=2.0.4",
"optparse": "1.0.3",
"asyncblock": "2.0.8"
}
Then I do the following in my /test.coffee scripts:
asyncblock = require('asyncblock')
When I start hubot, I get the error message: ERROR error: cannot find module 'asyncblock'
~ / hubot / node_modules / asyncblock exists. Therefore, I try:
require.paths.push('/home/ubuntu/hubot/node_modules')
Now I can not find the error, but I get a new one:
ERROR Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
What am I doing wrong?
I'm just trying to execute a system command on an ubuntu server where I have hubot running:
asyncblock((flow) ->
exec('node -v', flow.add())
result = flow.wait()
msg.send result
)
:
, NODE_PATH env var :
env NODE_PATH="/usr/lib/nodejs:/usr/share/javascript:/home/ubuntu/hubot/node_modules"
hubot/ node_modules??