I like nave for managing node versions. It is a simple shell script. I do not 
know if it is as well maintained as NVM. I do know that NVM once had a horrible 
bug merged in (the infamous "rm -rf /usr"), but I think it is better maintained 
now.

Anyway, here is nave:

https://github.com/isaacs/nave

Now, there is a lot of wisdom in what Aria said. Just avoiding global installs, 
whenever possible, is a good idea. A lot of times, when someone new to node 
asks about global installs, they are still thinking the ruby way (or <shudder> 
the CPAN way). With Ruby gems, dependencies are frequently installed globally. 
NPM prefers to bundle all dependencies locally.

You should pretend that "global installs" are the same as "global variables." 
You have probably heard that this is a code smell.

(For the rest of my post I am going to talk about grunt. This is because it is 
a common command line tool. If you are not familiar with it, it is a generic 
task runner that is used to minify front end CSS and JavaScript, and for many 
other things. Search on it and read the website -- there is excellent 
documentation.)

Suppose you want to standardize a version of node and grunt across a lot of 
frontend web applications (requires local install) but you also want freedom to 
run a staging application on 0.11.x so you can play around with ES6 harmony 
generators and koa and galaxy. Then a version manager makes sense.

You can download nave.sh to /usr/bin/nave and then execute

nave use stable
npm install -g grunt-cli

and nave will download and/or compile the latest stable version of node. And 
then it will install grunt.

Or, if you want V8 features from harmony, you can exit the other shell and do 
this:

nave use latest
node --harmony my-awesome-koa-app.js

and voìla, you have generators!

I know one drawback with nave is there does not seem to be a way to migrate 
global modules to a new version. E.g., if you installed grunt globally on node 
0.10.32 and then update to 0.10.33, you have to reinstall grunt on the new 
version. Maybe NVM handles that situation. At any rate, you should only ever 
install a few modules globally:

* grunt-cli
* docpad
* insert other framework with CLI commands...

An instructive historical note about grunt-cli: there was originally only one 
grunt module, which many people installed globally, but then they decided to 
split out a minimal subset of functionality out of the main "grunt" module and 
into a new module called "grunt-cli." So there's "grunt-cli" (typically global) 
and "grunt" (should be local). In other words, the maintainers of grunt 
recognized that global installs are problematic and so they split out a minimum 
of functionality into a separate module to balance this out.

One final thing: if you are thinking of putting ./node_modules/.bin into your 
path, I would advise against that from a security standpoint. You never want to 
have anything in your current directory automatically included in the path. You 
are asking for trouble, security-wise.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/0f01e92e-4fd6-49c9-8c28-fd64a92f34f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to