How do I use a local version of a module in node.js
. For example, in my app, I installed coffee-script:
npm install coffee-script
This installs it in ./node_modules
and the coffee command is in ./node_modules/.bin/coffee
. Is there a way to run this command when I'm in my project's main folder? I guess I'm looking for something similar to bundle exec
in bundler. Basically, I'd like to specify a version of coffee-script that everyone involved with the project should use.
I know I can add the -g
flag to install it globally so coffee works fine anywhere, but what if I wanted to have different versions of coffee per project?
npm install niftycommand
and thenniftycommand
. But this will never work unless you have ./node_modules/.bin in your path, will it?coffee
command into thenpm scripts
section, like"build": "coffee -co target/directory source/directoy", so you can run
npm run build` from the terminal afterwards.npx
which comes withnpm 5.2.0
medium.com/@maybekatz/…