简体   繁体   中英

Getting started with Hubot

I just pulled hubot down from github. I ran npm install from \\d\\projects\\hubot and got pounded with errors. The first error may be causing the rest:

d:\\projects\\hubot\\node_modules\\hubot-hipchat\\node_modules\\node-xmpp\\node_modules\\node-xmpp-core\\node_modules\\node-stringprep>node "d:\\Program Files\\nodejs\\node_modules\\npm\\bin\\node-gyp-> bin\\....\\node_modules\\node-gyp\\bin\\node-gyp.js" rebuild gyp ERR! configure error gyp ERR! stack Error: Command failed: gyp ERR! stack at ChildProcess.exithandler (child_process.js:647:15) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at maybeClose (child_process.js:755:16) gyp ERR! stack at Socket. (child_process.js:968:11) gyp ERR! stack at Socket.emit (events.js:95:17) gyp ERR! stack at Pipe.close (net.js:465:12) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "node" "d:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd d:\\projects\\hubot\\node_modules\\hubot-hipchat\\node_modules\\node-xmpp\\node_modules\\node-xmpp-core\\node_modules\\node-stringprep gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v0.13.1 gyp ERR! not ok

The first line is pointing to a folder that does not exist on my machine:

d:\\projects\\hubot\\node_modules\\hubot-hipchat\\node_modules\\node-xmpp\\node_modules\\node-xmpp-core

node-xmpp-core does not exist. I tried installing node-xmpp-client and node-xmpp-sever and once again...tons of errors.

Any idea how I can get to the bottom of this mess?

Turns out I started with the wrong command.

Mac Setup

After pulling down the repo, the right command to start with is:

sudo npm install -g yo generator-hubot

Other stuff you need:

This is where things get tricky.

  • mkdir myhubot
  • cd myhubot
  • yo hubot --owner="Bot Wrangler " --name="Hubot" --description="Delightfully aware robutt" --adapter=campfire --defaults

(yo hubot command installs hubot!)

Now switch back to the root directory \\wherever\\hubot

  • npm install (install all the other bits hubot also needs)

switch back to the created directory \\wherever\\hubot\\myhubot

  • Execute hubot :- bin/hubot (installs npm dependencies, loads scripts, launches hubot)

This will put you at a prompt and there will be a bunch of garbage on the screen. Hit <enter> . Now you get the correct prompt...

Hubot> and you can type "hubot help" to test him out.

If hubot does not respond to commands check to make sure you ran bin/hubot from the directory you created \\wherever\\hubot\\myhubot . You can run bin/hubot from the root, but the prompt won't respond to commands.

Full instructions for setup were found on github.

Windows Setup

Basically the same thing. Don't use sudo before any of the commands listed above. You also need two additional packages before Hubot will run. I recommend installing these first:

  1. Install Python 3.2: https://www.python.org/download/releases/3.2/
  2. Install LMXL : https://pypi.python.org/pypi/lxml/3.4.2 (the one related to Python 3.2)

Write some scripts to make him do interesting things.

  • \\wherever\\hubot\\myhubot\\scripts\\example.coffee is a good place to start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM