This plugin makes nenv transparently aware of project-specific binaries created by npm.
This means that binaries in your node_modules/.bin directories are automatically added to your shims.
This plugin is based on rbenv-binstubs by ianheggie.
To install nenv-binstubs, clone this repository into your ~/.nenv/plugins directory. (You'll need a recent version of nenv that supports plugin bundles.)
$ mkdir -p ~/.nenv/plugins
$ cd ~/.nenv/plugins
$ git clone https://github.com/madumlao/nenv-binstubs.git
Then for each application directory run the following just once:
$ npm install
$ nenv rehash
Simply type the name of the command you want to run! Thats all folks! Eg:
$ express --version
This plugin searches from the current directory up towards root for a directory containing a package.json. If such a directory is found, then the plugin checks for the desired command under the node_modules/.bin subdirectory.
To confirm that the local binary is being used, run the command:
$ nenv which COMMAND
To show which package npm will use, run the command:
$ npm ls PACKAGE
You can disable the searching for package binaries by setting the environment variable DISABLE_BINSTUBS to a non empty string:
$ DISABLE_BINSTUBS=1 nenv which command
You can list the bundles (project directories) and their associated binstub directories that have been registered since the plugin was installed using the command:
$ nenv bundles
This will add a comment if the directory is missing, or if a package.json no longer exists. If the package.json for a bundle is removed, then that bundle will be dropped from the list of bundles to check when nenv rehash
is next run.
Copyright (c) 2014 Mark Dumlao - Released under the same terms as rbenv's MIT-License
- Issues on GitHub for Known Issues
- Wiki for further information
- nenv for nenv itself (see thanks note below)
Thanks go to:
- ianheggie - nenv-binstubs was forked from his rbenv-binstubs plugin for rbenv!
- ryuone - for nenv.
- sstephenson - for rbenv