Skip to content

Instantly share code, notes, and snippets.

@iainsproat
Created March 15, 2012 20:11
Show Gist options
  • Save iainsproat/2046581 to your computer and use it in GitHub Desktop.
Save iainsproat/2046581 to your computer and use it in GitHub Desktop.
Using couchapp on node in Windows

Get node.couchapp:

git clone https://github.com/mikeal/node.couchapp.js.git
cd node.couchapp.js

install globally:

npm install -g

install locally, where test is the directory name which will contain your app:

cd ..
cd test
npm install ".\..\node.couchapp.js"

create the most basic app.js file as so:

var couchapp = require('couchapp')
var ddoc = {_id:'_design/app', shows:{}, updates:{}, views:{}, lists:{}};
exports.app = ddoc;

For some reason using node couchapp <command> app.js http://address.to.couch/database failed to work on windows. As of 2012-03-15 I received the following error:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Cannot find module '<path_to_directory>\test\couchapp'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

Instead I had to use the following to upload the app to couchdb:

node "./node_modules/couchapp/bin.js" push app.js http://address.to.couch/database

or with authentication I used:

node "./node_modules/couchapp/bin.js" push app.js http://username:password@address.to.couch/database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment