Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install node also install latest stable npm #696

Closed
nmccready opened this issue Mar 19, 2015 · 12 comments
Closed

install node also install latest stable npm #696

nmccready opened this issue Mar 19, 2015 · 12 comments
Labels
feature requests I want a new feature in nvm!

Comments

@nmccready
Copy link

Thanks for this wonderful utility and sorry if this is a dupe.

It would be great if npm was automatically installed to its latest stable version when installing a different version of node. npm being outdated always seems to bite me in the butt.

To resolve this I always have to remember to run npm install -g npm after a new install. I really feel this should be a default somehow.

@ljharb
Copy link
Member

ljharb commented Mar 20, 2015

It definitely can't be a default - many versions of node (think 0.6) won't work with the latest npm.

However, I'm open to an nvm install --update-npm option that attempted to npm install -g npm after installing a single version.

(duplicate of #668)

@ljharb ljharb added the feature requests I want a new feature in nvm! label Mar 20, 2015
@nmccready
Copy link
Author

Sounds like a great compromise.

@zacronos
Copy link

zacronos commented Apr 3, 2015

I would request that --update-npm accepts an optional version number (defaulting to latest stable if absent), so that it is possible to install a specific version of npm if desired. Seems much more in line with the spirit of nvm that way.

@ljharb
Copy link
Member

ljharb commented Apr 3, 2015

@zacronos at that point, why not nvm install x && npm install -g [email protected]?

@nmccready
Copy link
Author

Good point, however what about some. Nvmrc logic so peeps don't have to think about it hut once.

@ljharb
Copy link
Member

ljharb commented Apr 3, 2015

.nvmrc covers both use and install, updating npm is just on install, so nvmrc wouldn't be an appropriate place to think about it.

Installing a node version isn't a common action, so "having to think about things" when doing it isn't a burden, it's actually the appropriate time to be thinking about things. .nvmrc is simply a file-based way to communicate the desired version number.

nvm install 0.10 && npm install -g npm is already a pretty simple way to update npm to the latest. Also, fwiw, I personally do not ever want to automatically update npm - I test all my modules using the stock version that ships with a given version of node.

@jdarling
Copy link

npm install -g npm doesn't work when nvm links the npm symlink on linux machines to its specific node directory. Just tried this and got failure. Would love to see a way to say "don't install NPM for me" or at least an option to specify the npm version as well. We are locked to npm 2.7 with node 0.10.39 currently and had to go delete the .vmm//npm symlink to get back to my global version.

@ljharb
Copy link
Member

ljharb commented Jul 16, 2015

@jdarling what does your npm root -g say? npm install -g npm@latest most certainly should work, unless you have a custom prefix set (which breaks nvm). nvm creates no symlinks, so I'm not sure what symlink you're referring to. Perhaps you installed nvm from npm, which is an incorrect and old version?

Try the curl command in the README to install the latest nvm, and then see if the problem remains.

@jdarling
Copy link

npm root -g
returned
/home/jdarling/.nvm/v0.10.38/lib/node_modules

Actually I think I've had nvm for so long that I don't honestly remember how I installed it. What is the proper purge if you don't know where it is 🎱

I'll install via CURL after I make sure I kill everything off.

@ljharb
Copy link
Member

ljharb commented Jul 16, 2015

Simply reinstalling via curl should install over the old one. However, based on npm root -g, you should be fine.

@ljharb
Copy link
Member

ljharb commented Dec 16, 2017

This is now possible; nvm install whatever --latest-npm, or nvm install-latest-npm.

This has the advantage of ensuring you install the latest version of npm that actually works on your version of node, instead of just the latest one.

@ljharb ljharb closed this as completed Dec 16, 2017
@waldyrious
Copy link
Contributor

This is now possible; nvm install whatever --latest-npm, or nvm install-latest-npm.

For future reference, that was done in commit cbdd41e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm!
Projects
None yet
Development

No branches or pull requests

5 participants