Skip to content

Instantly share code, notes, and snippets.

@emmanuelnk emmanuelnk/.bashrc
Last active Jan 17, 2020

What would you like to do?
Installing virtual node environments with nodeenv.
# start nodeenv virtual env if it exists
# for whenever you open integrated terminal in vscode
if [ -d ".nenv" ]; then
. ".nenv/bin/activate"

summary of readme @

to install

sudo pip install nodeenv
nodeenv .nenv --node=8.9.3

to activate

. .nenv/bin/activate

to deactivate


packages to be installed are kept in requirements.txt, like virtualenv

> cat ../prod-requirements.txt

to install node.js from source

nodeenv --node=0.10.25 --source .nenv-0.10.25

If environment's directory already exists then you can use --force option

nodeenv --requirements=requirements.txt --jobs=4 --force nenv

create a new environement with the system-wide node

nodeenv --node=system

list locally installed packages

freeze -l ../prod-requirements.txt

create an environment from a requirements file

nodeenv --requirements=../prod-requirements.txt --jobs=4 .nenv

to add nodeenv to a project with python env (venv) first activate python .venv

. .venv/bin/activate

add a node virtual environment to this existing venv

nodeenv -p --node=x.x.x

if you already have an environment and want to update packages from requirements file you can use --update option:

. .nenv/bin/activate
nodeenv --requirements=requirements.txt --update .nenv

use ~/.nodeenvrc to set defaults

cat ~/.nodeenvrc
debug = False
jobs = 2
make = make
node = latest
npm = latest
prebuilt = False
profile = False
with_npm = False
without_ssl = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.