Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

nodenv/wfarr-nodenv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

This version of nodenv has been deprecated in favor of: nodenv/nodenv

nodenv

rbenv, but for node.

Installation

To install the latest stable release:

git clone https://github.com/nodenv/wfarr-nodenv.git ~/.nodenv

Then add the following to your shell config at the end:

export PATH="$HOME/.nodenv/bin:$PATH"
eval "$(nodenv init -)"

Finally, install and use a node version

nodenv install v0.10.26
nodenv global v0.10.26

Global install

To install nodenv for usage by all users on the system, this will provide the proper environment variables to be set on login shells. Setting the group ownership allows members of the group, below creates a new group, you can use a pre-existing one also. To add a user to this group usermod -aG nodenv user

git clone https://github.com/nodenv/wfarr-nodenv.git /usr/local/lib/nodenv
sudo /usr/sbin/groupadd nodenv
sudo chgrp -R /usr/local/lib/nodenv
sudo chmod g+ws /usr/local/lib/nodenv

Then add the following to /etc/profiled.d/nodenv.sh

export NODENV_ROOT=/usr/local/lib/nodenv
export PATH=$NODENV_ROOT/bin:$PATH

eval "$(nodenv init -)"

# Make sure locally install binaries get priority
export PATH=node_modules/.bin:$PATH

Usage

» nodenv help
Usage: nodenv <command> [<args>]

Some useful nodenv commands are:
   exec        Execute a command from a particular NodeJS version.
   shell       Set NODENV_VERSION for the lifetime of a shell.
   local       Persist the preferred NodeJS version in the cwd.
   global      Persist the preferred NodeJS default version.
   install     Install a version of NodeJS.
   uninstall   Uninstall a version of NodeJS.
   version     Show the current NodeJS version.
   versions    Display all versions of NodeJS installed in `${NODENV_ROOT}/versions/*'.
   rehash      Rehash nodenv shims (run this after installing executables)

See `nodenv help <command>' for information on a specific command.

Usage with Node.js

# Use 0.8 versions
nodenv install v0.8.28

# Use 0.10 versions
nodenv install v0.10.40

# Use 0.12 versions
nodenv install v0.12.7

Usage with io.js

# Use any io.js version
nodenv install iojs-v2.4.0

# You can also install the latest version of io.js
nodenv install iojs

Credits

Forked from @wfarr's nodenv.

This library was heavily, heavily, heavily inspired by @sstephenson's rbenv and ruby-build projects. A few ideas were also taken from nvm.

A number of patterns and utilities are borrowed from that project, and it is my hope that nodenv provides the same simplicity, elegance, and usability that I've come to love in rbenv and ruby-build for NodeJS users.