Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using node.js in webfaction
#taken from //
#the "forever" part taken from //
#thanks to [Ryan s]( and [Dave Stevens](
mkdir -p $HOME/src
cd $HOME/src
wget ''
tar -xzf node-v0.8.9.tar.gz
cd node-v0.8.9
# All of these scripts use "#!/usr/bin/env python". Let's make that mean python2.7:
mkdir MYPY
ln -s $(which python2.7) $PWD/MYPY/python
./configure --prefix=$HOME
make # 5.5m
make install
# restore the PATH (we don't need `$PWD/MYPY/python` anymore).
# Then, make sure $HOME/bin is on the PATH
export PATH=$HOME/bin:$PATH
echo 'export PATH="$HOME/bin:$PATH"' >> $HOME/.bashrc
hash -r
# Set the node modules path
export NODE_PATH="$HOME/lib/node_modules:$NODE_PATH"
echo 'export NODE_PATH="$HOME/lib/node_modules:$NODE_PATH"' >> $HOME/.bashrc
# now install express framework
cd $HOME
npm install -g forever
npm install -g express
npm install -g stylus
npm install -g jade
# create express framework "hello world" project
mkdir -p $HOME/node_projects
cd $HOME/node_projects
express -s -c stylus helloworld
cd helloworld
# use the PORT from your Custom Application created at the beginning!
sed -i "s/app.set('port', process.env.PORT || 3000);/app.set('port', process.env.PORT || $PORT);/" app.js
# run it
cd $HOME/node_projects/helloworld
forever start app.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment