These days we are playing with serverside javascipt programming using node.js and coffeescript. Zappa looks like a promising web development framework, strongly based on the ruby-based Sinatra.
We installed it with the standard
npm install zappa --global
but for some reason any time we tried to run it we got a big Cannot find module ‘coffee-script/lib/optparse’ error.
Anyway, we managed to do an ugly hack that got it to work.
1/ Find where npm installed your zappa module. In our case we found it via the error message: /opt/local/lib/node/.npm/zappa/0.1.5/package/bin/zappa
2/ Go there and open the package/lib/cli.js file
3/ Find the failing statement: OptionParser = require(‘coffee-script/lib/optparse’).OptionParser;
4/ Jam in the absolute path. In our case it was:
OptionParser = require(‘/opt/local/lib/node/.npm/coffee-script/active/package/lib/optparse’).OptionParser;
5/ Ugly as hell, but now it works!
It looks like node had trouble resolving the path of the coffeescript sub-library and this is the only way we could make it work.
Do you have a more elegant solution?
Tags: Coffeescript, debugging, Javascript, Node.js, npm, Zappa