How to use a node module outside of node?

I installed the sass node module through npm and want to use it to compile some scss stylesheets which are not in a node environment.

Ideally I want to be able to use it like the coffeescript compiler

sass -cw somestylesheet.scss

But anything that gets me close to there will do.

I don't see any commandline utility. Is there some sort of standard way to do this sort of thing with node?

I'm sure you're already hacking together a little sass-compiler script, but here is some more background info:

To install a module globally in node using npm, npm reads the "bin" hash in package.json, to find a number of global names mapped to their corresponding scripts.

Here is an example I took from express:

{
  "name" : "express"
  ...
  "bin": { "express": "./bin/express" },
  ...
}

This tells npm to make the express script globally available, when you install the package with npm install -g <package-name>

I've checked https://github.com/andrew/node-sass/blob/master/package.json and it has no "bin" hash in its package.json, so you'll have to write one yourself.

As @peter-lyons has said, you start an executable node script with

#!/usr/bin/env node

your code

depending on the operating system you are using, you might also have to make the script executable with chmod +x yourScript. Then you should just be able to execute your script from any console, if you either put it on the global path, or if you call it as ./yourScript.