avm 0.6.0

Manages node.js installations
avm-0.6.0 is not a library.

avm Build Status

Motivation

Right now to install multiple versions of node.js there's nvm available. It does a decent job but there's one disadvantage: It's written in Shell. On the one hand that's nice because it's easy to install on Unix machines, but on the other hand it's not usable on Windows machines and Shell code is not easy to understand. At least for me. Especially the latter reason is important for me. It is not that easy to find a person who can maintain Shell code and also it's not that easy to figure out where to look when something goes wrong.

Since Rust has become stable this year, I took the opportunity and began to write a replacement for nvm. It's called avm as abbreviation for "All version manager". In the future I want to be able to not only install node.js but also Ruby and Python on my machine in a convenient way. The other advantage is since Rust runs on many platforms, there's also the possibility to run avm on machines without Bash e.g. Windows.

Installation

Via Cargo Install

If you use Cargo 0.6.0 (ships with Rust 1.5) you can install avm via:

$ cargo install avm

From Source

It installs from source, for that you need to have git and Rust stable installed.

To install avm on your system, run the following:

curl https://raw.githubusercontent.com/schultyy/avm/master/install.sh | bash

If Rust is not installed yet, visit https://www.rust-lang.org/downloads.html and download the version for your operating system.

After installation finished, you need to make sure that avm is in your PATH. For that you need to append the following line to either ~/.zshrc or ~/.bash_profile:

export PATH=~/.avm/:~/.avm/bin:$PATH

If you encounter the following compilation error on a Linux based system:

$ cargo build
#...
failed to run custom build command for `openssl-sys v0.6.6`

make sure that you have the following package installed: Ubuntu:

$ sudo apt-get install libssl-dev

RHEL:

$ sudo yum install openssl-devel

Supported platforms

Right now, it is possible to run avm on the major Linux distributions and Mac OS X. There is no support for Windows right now. See #33 for details.

Usage

Install a new node version:

$ avm install 4.1.2

Please note, that right now avm installs precompiled versions of Node.js. There is no supported yet for installing from source.

Use 4.1.2 by default:

$ avm use 4.1.2

Use your system node version:

$ avm use system

List all installed versions:

$ avm ls

Uninstall a version:

$ avm uninstall 4.1.2

Select the node version based on the package.json in the current directory:

$ avm autoselect

Note that this depends on the engines property set in the package.json. If engines specifies a node version < 4.x, then it checks for strict equality only. It does not support any modifiers like ^ or ranges for these versions.