is there an virtual environment for node.js?


Question

I've searched the wiki modules page, but I can't find anything similar to virtualenv (python) or rvm.

Anyone here separates node.js in their own env? I really don't like to install npm system-wide.

1
123
8/4/2018 12:45:08 PM

Accepted Answer

If having system wide npm packages is your main issue, then maybe consider using the very cool 'bundle' command with npm. This is closer to freezing gems or using bundler in rails, rather than rvm.

It's super easy. Just create a package.json file:

{ "name": "yourapp", "version": "0.0.1", "dependencies": {"jade": "0.4.1"}}

and then run:

npm bundle vendor

or if your npm version is >= 1.0 run:

npm install

to freeze into the vendor directory. and then use:

require.paths.unshift('./vendor');
39
10/3/2014 1:33:49 PM

nodeenv - virtual environment for node.js ( Analog virtualenv )


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon