Created
March 21, 2018 11:30
-
-
Save prasadtalasila/a5548c181a16846dc18466170897f925 to your computer and use it in GitHub Desktop.
virtualenv like setup for node.js projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assume that a node project exists in /home/alan/autolabjs with the corresponding dependencies in | |
/home/alan/autolabjs/node_modules. Let's also say we have mocha dependency installed in node_modules. | |
Now, a regular way to use the installed dependencies is to execute mocha is as follows. | |
$cd /home/alan/autolabjs/ | |
$./node_modules/.bin/mocha <rest of the command> | |
Since the soft links to all the installed node modules are available in | |
/home/alan/autolabjs/node_modules/.bin directory, we can add this directory to the PATH variable | |
to utilise all the installed dependencies like regular shell utilities. | |
$export PATH="/home/alan/autolabjs/node_modules/.bin":$PATH | |
Now to execute mocha, we only need to say | |
$mocha <rest of the command> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment