ny

nodejs version manager

Usage no npm install needed!

<script type="module">
  import ny from 'https://cdn.skypack.dev/ny';
</script>

README

ny (nodejs version manager)

nodejs (including io.js and supports release candidates) version manager written in bash with no subshells, no profile setup, no convoluted api, just simple.

Installation

$ npm install -g ny

or

$ make install

to $HOME. Prefix later calls to ny with NY_PREFIX=$HOME

$ NY_PREFIX=$HOME make install

Installing Binaries

Install a few nodes:

$ ny 2.5.0
$ ny 0.12.4
$ ny 4.0.0

Type ny to prompt selection of an installed iojs. Use the up / down arrow to navigate, and press enter or the right arrow to select, or ^C to cancel:

$ ny

  0.12.0
  2.5.0
ο 4.0.0

Use or install the latest official release:

$ ny latest

Use or install the stable official release:

$ ny stable

Switch to the previous version you were using:

$ ny prev

Removing Binaries

Remove some versions:

$ ny rm 0.12.5 v2.5.0

Instead of using rm we can simply use -:

$ ny - 0.12.5

Binary Usage

When running multiple versions of iojs, we can target them directly by asking ny for the binary path:

$ ny bin 4.0.0
/usr/local/n/versions/1.0.4/bin/node

Or by using a specific version through ny's use sub-command:

$ ny use 4.0.0 some.js

with flags:

$ ny as 4.0.0 --debug some.js

Usage

Output from ny --help:

Usage: ny [options] [COMMAND] [args]

Commands:

  ny                            Output versions installed
  ny latest                     Install or activate the latest iojs release
  ny stable                     Install or activate the latest stable iojs release
  ny <version>                  Install iojs <version>
  ny use <version> [args ...]   Execute iojs <version> with [args ...]
  ny bin <version>              Output bin path for <version>
  ny rm <version ...>           Remove the given version(s)
  ny --latest                   Output the latest iojs version available
  ny --stable                   Output the latest stable iojs version available
  ny ls                         Output the versions of iojs available
  ny c                          Output the current version of iojs installed

Options:

  -V, --version   Output current version of n
  -h, --help      Display help information

Aliases:

  which   bin
  use     as
  list    ls
  -       rm

Details

ny by default installs node to /usr/local/ny/versions, from which it can see what you have currently installed, and activate previously installed versions of node when ny <version> is invoked again.

Activated nodes are then installed to the prefix /usr/local, which of course may be altered via the NY_PREFIX environment variable.

To alter where ny operates simply export NY_PREFIX to whatever you prefer.

License

(The MIT License)

  • Copyright (c) 2015 Kenan Sulayman <kenan@sly.mn>
  • Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.