Installing couchapp

.

Having installed couchdb and geocouch the time was right to install couchapp!

First, I had to install node.js.  I cloned from github into /usr/local/src:

git clone https://github.com/joyent/node.git

Then entered the node directory and checked out a version that would install with make:

cd node
git checkout v0.6.3

I then configured and installed.  I installed into /usr/local:

./configure --prefix=/usr/local
make
sudo checkinstall

This installed node.js files throughout a number of the existing directories in the /usr/local directory.

Second was to install npm.  I cloned from github into /usr/local/src:

git clone https://github.com/isaacs/npm.git

then entered the npm directory and installed:

cd npm
sudo make install

npm files were installed within directories of the /usr/local directory.

Couchapp was installed globally:

sudo npm install couchapp -g

Installing to:

/usr/local/bin/couchapp
/usr/local/lib/node_modules/couchapp

I received this error:

The "sys" module is now called "util". It should have a similar interface

This was fixed by modifying 2 files:

./lib/node_modules/couchapp/main.js
./lib/node_modules/couchapp/node_modules/watch/main.js

By changing

sys=require('sys')

to

sys=require('util')

in both files.

I received this error when running couchapp to push for the first time:

Error: Cannot find module 'couchapp'

This was fixed by setting the following environment variable:

export NODE_PATH=/usr/local/lib/node_modules

Which I’ve also saved into the /etc/environment file.

Leave a comment