Skip to content

Instantly share code, notes, and snippets.

@slugbyte
Last active November 24, 2016 17:15
Show Gist options
  • Select an option

  • Save slugbyte/19156a12f22ecf3a99d0f84de5c9ca1b to your computer and use it in GitHub Desktop.

Select an option

Save slugbyte/19156a12f22ecf3a99d0f84de5c9ca1b to your computer and use it in GitHub Desktop.

401 PRE-WORK INSTALL NODE

# Install NVM

Download NVM

  • Open the command line
  • Copy the folling command in and press enter
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

This will create the directory ~/.nvm and install nvm into it

  • run ls -a ~/ and look for the .nvm directory

Configure BASH to load nvm

  • Run the command touch ~/.bashrc ~/.bash_profile
    This will make sure the files ~/.bashrc and ~/.bash_profile exist
  • Open the ~/.bash_profile and ~/.bashrc files in your text editor
  • Add the following lines to the end of your ~/.bash_profile
# Read $HOME/.bashrc, if present.
if [ -f $HOME/.bashrc ]; then
  source $HOME/.bashrc   
fi
  • Add the following lines to the end of your ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

The Bash configuration files are loaded by bash at different times. We edit them both to ensure node will allways be setup.

  • ~/.bash_profile is the personal initialization file, executed for login shells
  • on OSX this runs every time you open a new terminal window
  • on Linux this runs every time you login to your computer
  • ~/.bashrc is the individual per-interactive-shell startup file
  • on OSX this runs every time you type the command bash
  • on Linux this runs every time you open a terminal or type the command bash
  • run source ~/.bashrc to load the new configuration
  • run command -v nvm to verify that nvm is installed (it should output "nvm")

# Install NodeJS

  • run the command nvm install 6
    this will install the latest version of node 6
  • Open ~/.bashrc in your text editor
  • Add the following line to the end of your ~/.bashrc to configure nvm to use NodeJS version 6
nvm use 6
  • run node -v to verify NodeJS v6 is installed (it should output "v6.x.x")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment