11/28/2014 - 12:45 PM

installing hubot notes

installing hubot notes

sudo apt-get update

## was requested but I already had it 
sudo apt-get install build-essential

# installing node
sudo add-apt-repository -m ppa:chris-lea/node.js 
# in case add-apt-repository wasn't found use $ sudo apt-get update
sudo apt-get update
sudo apt-get install nodejs

# check node is running
# test by pasting the following into a shell
cat > ~/server.js <<EOF
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "");
console.log('Server running at');
# then use
node ~/server.js
# then check "Hello World" found in 
# BINGO node is installed :D
## if u ever tried to install npm ... it's already bundled with nodejs ... reinstalling it will show a dependency error (that's so OK!)

# install git
## it was already installed, no need for me to install it :D

# install other dependencies
sudo apt-get install libssl-dev redis-server libexpat1-dev

# some dependencies in node too
sudo npm install -g coffee-script

# clone hubot wherever u want #assuming its .
git clone git://github.com/github/hubot.git

Installing Hubot
cd master && sudo npm install

install hubot itself: (ref: master/docs/index.md)
sudo npm install -g yo generator-hubot

(if a newer npm version is required): (ref: https://libraries.io/npm/npm/2.8.0)
mkdir ../npm && cd ../npm
curl -L https://www.npmjs.com/install.sh | sh

(if a higher access is required):
curl -L https://www.npmjs.com/install.sh | sudo sh

Execute Hubot

# here I got the following error: "ERROR Error: listen EADDRINUSE", the error means the port (8080) is already taken 
# 2 solutions we have got here:
# [1] use this command to know which app is taking it then close it 
lsof -i :8080
# [2] make both hubot and the other app listening to 8080 work together
# that's even simpler, we'll need to define the env. variable PORT with a value ... 9090 as an example and execute hubot over this port
export PORT=9090
# now there's no port conflict but hubot is still not answering :/
# if we used: sudo make ... tests will work, except for 'Robot "before each" hook:' which throws "Uncaught Error: listen EADDRINUSE"

## my reference: http://how-to.linuxcareer.com/how-to-install-and-use-hubot-robot-on-ubuntu-machine?google_comment_id=z12aif3xvvv0ijsqe04cg51hwmmxj50px4g
## another ref: http://blog.diniscruz.com/2013/06/trying-to-running-hubot-and-being-stuck.html