Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use NVM To Install Latest NodeJS For Specific Major Version

Tags:

nvm

I want to install the latest minor/patch version of NodeJS 4 using nvm. I don't just want "latest", because that would be NodeJS 8 or whatever later, potentially breaking-change version is out now.

If it were an npm dependency, I would be able to say nvm install "^4", but that doesn't work. Is there a simple command to do this? If there isn't, is there something I can do on the command line to find the latest version and install it in a one-liner that works on both Windows and Unix-based consoles?

like image 260
meustrus Avatar asked Jun 27 '17 20:06

meustrus


1 Answers

(nvm maintainer here)

If you run nvm --help (make sure you're using the latest version of nvm), you'll see a description of all the things nvm supports. Specifically, nvm does not support semver ranges, however, nvm install 4 or nvm install 4.x will install the latest available version of node 4.

Separately, you can use nvm install --lts=argon (and nvm alias default lts/argon if you want to peg to the LTS line specifically instead of just v4.

like image 130
LJHarb Avatar answered Sep 27 '22 22:09

LJHarb