Node.js is sometimes confusing when it comes to version management...
I am trying to arrange various projects as i am doing with ruby projects. For example:
With ruby i can create file such as .rvmrc
and fill with something like rvm --create use 1.9.3@my-app
This thing creates and uses all gems specifically to configured gemset. Which allows to have various options for any kind of project, and switch easily among them. So ruby does this in one place.
I want to achieve this for node.js projects.
Node works differently. I want to know the details about that, and especially of each node version management tool.
The point is to know which version management tool for which goal...
And why there are so many.
More accurately: i want npm install <package-name>
to chosen node version. And after switching to other versions, this installed package to be missing, or have different version installed before (or certain one). Just like gemset
is working.
I've been looking for clarification too:
Both allow switching & installing between node versions.
nvm will symlink the different versions to /usr/local/bin/node, and n will move your node installs to the path (/usr/local/bin/node).
I don't fully understand the latter part of your question, but in regards having control with node projects/apps, you can use
npm install [package_name] --save-dev
to save your npms within your 'project'.These npm module versions (^semver) get detailed in your package.json file, for example
"gulp": "^3.8.5"
is different from"gulp": "3.8.5"
(the later being specific to v3.8.5, and the ^3.8.5 means allowing any future version of 3, but not 4.0.0)The differences between npm and gem is that npm installs the specified packages in the local node_modules folder (the current working directory using the
--save-dev
), so you have less worries with cross project module versions.Important note: Running --save (instead of --save-dev) installs any missing dependencies.
I hope that helps a little :o)