How to use executables from a package installed locally in node_modules?

前端 未结 22 2296
时光说笑
时光说笑 2020-11-22 12:40

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
22条回答
  •  再見小時候
    2020-11-22 13:19

    Use npm-run.

    From the readme:

    npm-run

    Find & run local executables from node_modules

    Any executable available to an npm lifecycle script is available to npm-run.

    Usage

    $ npm install mocha # mocha installed in ./node_modules
    $ npm-run mocha test/* # uses locally installed mocha executable 
    

    Installation

    $ npm install -g npm-run
    

提交回复
热议问题