Search code examples
npmcompass

Is There A Way to NPM Install Compass and Still Run it at the Command Line?


With most NPM packages you can invoke their command line application by running it from the bin folder inside the package's folder in node_modules:

npm install foo
./node_modules/foo/bin/foo

Now of course you can do this more easily if you install the package globally:

npm install -g foo
foo

but that's generally considered to be a bad practice.

With the compass package however this doesn't appear to be the case. When you do:

npm install compass

the package's node_modules directory doesn't even have a bin folder.

So, my question is, is there anyway to install compass non-globally, but still be able to invoke it from the command line?

P.S. I know I could also install compass through the system, ie. sudo apt-get install compass, but I was hoping I could keep my process simple and have NPM manage everything.


Solution

  • It turns out the answer is no, because the compass NPM package doesn't actually include compass. Rather, the package is a JS front-end to the compass executable, which must be installed separately. Presumably this is because compass relies on Ruby, and they didn't want to make Ruby a package dependency.

    So if you want to use Compass it will have to be part of the system-level (on Linux, apt-get install) setup.