Coder Social home page Coder Social logo

nodenv's Introduction

nodenv

rbenv, but for node.

Installation

To install the latest stable release:

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

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

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

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 -b v0.3.4 https://github.com/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

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.

nodenv's People

Contributors

atsjj avatar cronopio avatar johnbellone avatar raganwald avatar rtgibbons avatar wfarr avatar xdissent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nodenv's Issues

question regarding platform/architecture support

Besides Darwin, the following architectures are common for node distributions:

linux-arm-pi
linux-arm64
linux-armv6l
linux-armv7l
linux-x64
linux-x86
sunos-x64
sunos-x86

Thanks to b15076c (specifically https://github.com/wfarr/nodenv/blob/master/libexec/nodenv-install#L88-L94) this should theoretically support these architectures. However, I'm curious how many of these have been tested. The code defaults to uname -p (unless uname -m == X86_64). According to some examples on wikipedia, uname -m is more trustworthy.

May I ask where you got this code, or why you chose to prefer uname -p?

wfarr-nodenv maintainers

I'm opening this issue here since https://github.com/nodenv/wfarr-nodenv was a fork and as such doesn't have its own Issues. (And I don't want to enable Issues on an archived repo)

The original members of the nodenv org are @wfarr @ericanderson @rtgibbons and @xdissent. Now that we're joining efforts between the wfarr version and OiNutter's version, I wanted to at least notify existing members. The plan is to transfer OiNutter's version into the nodenv org as nodenv/nodenv, wfarr's nodenv is archived as nodenv/wfarr-nodenv. And the org will be assuming ownership and maintenance of plugins, including node-build and likely a number of https://github.com/OiNutter/nodenv/wiki/Plugins

The tracking issue for the migration is on OiNutter's repo: nodenv/nodenv#27

Now that everyone's mostly up to speed, it's up to all of you (@wfarr @ericanderson @rtgibbons and @xdissent) if you'd like to remain in the org.

Confusion around this version and OiNutter's version

When using Boxen, it seems that everything has switched over to nodenv. By looking at the source, it's clearly using this version of nodeenv, but searching in google bring up https://github.com/OiNutter/nodenv instead, which seems more complete (despite the readme being a nearly exact copy of rbenv).

Would it be worth starting a conversation about merging the projects or deprecating one of them? It doesn't seem like either one has really taken off yet.

nodenv breaks man pages

paul@mercury:~/Desktop/rdio-play-here/chrome/app% man bower
No manual entry for bower
paul@mercury:~/Desktop/rdio-play-here/chrome/app% man yeoman
No manual entry for yeoman
paul@mercury:~/Desktop/rdio-play-here/chrome/app% man karma
No manual entry for karma
paul@mercury:~/Desktop/rdio-play-here/chrome/app% man node
No manual entry for node
paul@mercury:~/Desktop/rdio-play-here/chrome/app% man npm
No manual entry for npm

System Wide node libraries

The scenario for this is on a shared server with many users. Right now we have a dev server, and each client or sometimes project, will have their own user account on the system. We use Grunt on all projects, and have a variety of projects in Node.js where we can't upgrade to the latest version. Nodenv solves this, but each user on the box would have to compile their versions of Node needed.

The goal here is to only have to do this once. The problem could become with install global node modules.

What would be nice is to install node versions globally, and then nodenv would maintain ~/.nodenv for each user, allowing node modules to be manipulated per user, and each user allowed to have their own version run separately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.