I'm looking into playing around with Koa and I need to run the newest unstable version of NodeJS.
Is there a simple apt-get
or npm
or even node
call I can make to get the newest NodeJS version?
You should install nvm, or another node version manager, such as n, which has less github stars, but it was released later, it can be installed with just npm: npm install -g n
, and it contains a simpler api.
(Below substitute nvm install
with n
. The other commands are identical just substitute nvm
for n
.)
NVM has a remote command line install script:
`curl https://raw.githubusercontent.com/creationix/nvm/v0.20.0/install.sh | bash`
Or clone the repo $ git clone creationix/nvm
Then add to either your $HOME/.zshrc
, $HOME/.bashrc
, or $HOME/.profile
:
$ source path/to/.nvm/nvm.sh
With nvm installed, then install needed node versions, and finally set aliases to easily switch between versions.
For example:
$ nvm install 0.8
$ nvm install stable
$ nvm install unstable
$ nvm install 0.9.21
$ nvm alias work 0.9.21
$ nvm alias legacy 0.8
When leaving off the patch number it installs the latest patch under that version, as do the keywords stable
and unstable
.
As of winter 2014 this installs and creates an alias to:
v0.10.x
as stable
.v0.11.x
as unstable
(even/odd digit versions === stable/unstable).v0.8.x
as legacy
.v0.9.21
as work
. To switch between versions: nvm use alias
nvm use work
would switch to 0.9.21 while nvm use stable
would switch to the latest local v0.10.x
, and nvm will complain if you try to use a version that has not been downloaded.To check if there are more recent versions use: nvm ls-remote
.
To see the locally installed node versions: nvm ls
To uninstall nvm delete node related directories: ~/.nvm
, ~/.npm
, and ~/.bower
with the standard $ rm -rf
There is not a lot of magic in either library.
NVM works by installing each version of node under $HOME/.nvm/
and then symlinks the active version to the .nvm/bin
directory, including any command-line tools installed globally via npm -g
, which is provided to user's $PATH
.
See the nvm's usage section or n's usage section for an easy overview of the rest of the their commands .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With