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.
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.
bxjx's answer is conceptually accurate. However, please note that the bundle command no longer takes a directory. It always drops packages into the node_modules folder, so that npm knows where to find them later (and can avoid double-installing dependencies).
Any solution will probably involve installing npm and nave "system-wide" (that is, in your PATH, which could be in ~ somewhere), but then only installing your specific dependencies in the virtual environment.
I responded more thoroughly on the github issue.
tl;dr: The use case is valid and helpful, and while it's mostly there, it's not as well served as it could be. We should make sure to think it through and do it right.
You can use miniconda, as explained here.
This allows you to combine python & nodejs in a single conda environment to do all your development work isolated from the global system:
conda create --name my_env python=3.9 nodejs
conda activate my_env
# optionally, also install yarn
conda install -c conda-forge yarn
##############################################
# check it works
# python related
pip --version
python --version
# nodejs related
yarn --version
npm --version
node --version
##############################################
# verify they're inside the conda environment
# python related
which pip
which python
# nodejs related
which yarn
which npm
which node