Skip to content

Instantly share code, notes, and snippets.

@spencerbeggs
Created March 20, 2018 23:29
Show Gist options
  • Save spencerbeggs/da94898a9151f844fb755ed162fa7e99 to your computer and use it in GitHub Desktop.
Save spencerbeggs/da94898a9151f844fb755ed162fa7e99 to your computer and use it in GitHub Desktop.
Node Setup

Below is a walkthrough of that gets a developer working on a Mac a useable local environment.

Install Xcode

If you are using a Mac, you should first install Xcode from the App Store. Once it is installed, open it, accept the EULA. Next you can install Xcode Commandline Developer Tools:

xcode-select --install

If you aren't on a Mac, just make sure you have a gcc compiler available on your system.

Install OpenSSL

If you are running OS X High Sierra, you will need to install OpenSSL on your system to be able to use the reverse proxy. You can do this with the Homebrew package manager. To install Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now you can install OpenSSL with Homebrew:

brew install openssl

Install Node.js With nvm

nvm is a handy utility that lets you switch between multiple Node versions without needing to mess with the base version on your computer. To install:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
source ~/.nvm
nvm install 8
nvm use 8

Install node-gyp

This might not be necessary for your system, but we may as well globally install the node-gyp for compiline native add-ons.

npm install -g node-gyp

Now, you have a sturdy Node setup.

Install Yarn

Yarn is an alternative package manager for Node. In this documentation, we will use yarn instead of npm commands. For the most part they are interchangeable. The command yarn some-script is the same as npm run some-script. To install:

curl -o- -L https://yarnpkg.com/install.sh | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment