Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run node package from commandline [duplicate]

I see a lot of examples on the internet, that say:
1. install a node package using: npm install package for example npm install node-sass
2. to run the package from the commandline just call the package + arguments like so:
node-sass --output-style compressed -o dist/css src/scss

I'm new to node.js and I'm probably doing something wrong or I just don't understand it yet, but I have to do the following to use the package from the commandline:
node node_modules/node-sass --output-style compressed -o dist/css src/scss

What am I doing wrong?

like image 730
projectIncomplete Avatar asked Mar 21 '16 12:03

projectIncomplete


1 Answers

You're on the right track. If installing locally (without -g option) as you did, you have to manually dig what's included in a package. But check out node_modules/.bin, since that is where any command line tools are placed.

Typically any package that provides binaries is installed with npm install -g package that performs a system install. Binaries from globally installed packages are in path and work form the command line as expected. So maybe this is the option that would work the best for you.

like image 62
pspi Avatar answered Nov 12 '22 02:11

pspi