1

I really like virtual environments in Python, where you can put a whole Python environment including the interpreter into a project directory. If you dig out an old project after years you can just activate the environment and you are ready to go - this is awesome.

What is the node.js way of doing this?

Cœur
  • 32,421
  • 21
  • 173
  • 232
Rotareti
  • 31,464
  • 14
  • 87
  • 93
  • 1
    Possible duplicate of [is there an virtual environment for node.js?](http://stackoverflow.com/questions/3653495/is-there-an-virtual-environment-for-node-js) – Paul Jun 03 '16 at 11:24

1 Answers1

2

Usually you mark down the package versions and Node.js version that your code supports in the appropriate package.json directive. This means that distributed versions of your projects import the same modules. Locally, this doesn't matter as npm installs your packages in the project directory by default.

However, for managing your local Node versions more efficiently, a tool such as Node Version Manager will do the trick. NVM specifically supports a .nvmrc file in the project directory to mark down the Node version.

boxmein
  • 844
  • 7
  • 17