Skip to content


Subversion checkout URL

You can clone with
Download ZIP


npm shortcut #75

pthrasher opened this Issue · 8 comments

4 participants


Hey guys,

The below sh snippet will make npm always work, and always be the current version. I'd like to add this to the readme, but wasn't sure what section / etc would be preferable. I'm putting this here both as a reference, and for us to discuss. I'll submit a pull request if @visionmedia can let me know where to put it, or if he'd like to put it in there, etc.

function npm() {
    active=$(node --version);
    n npm $active $@
tj commented

yeah we just need to install npm properly when you n <version>


What's your current workaround for this within your own workflow?


+100 for this, this shortcut just saved my life


Glad I could help. :-)

tj commented

i cant remember if we fixed npm installs haha, I've just installed node directly the last few times, but I guess my point is that you shouldn't need this at all


Ahh, I see. Well, for whatever reason, I did... And this make npm always do the right thing.

@tj tj closed this

Just curious: Why was this closed if the work around didn't actually make it into the documentation/ no action was taken? At the very least a short explanation as to the rational for closing (all the tickets related to this topic) would be nice... I really appreciate n's usability compared to say nvm ... but this makes me think twice about it.

tj commented

npm is installed along with the rest of node, if not then it's a bug, works fine for me though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.