Skip to content

Javascript

To streamline your JavaScript development, it’s crucial to have Node.js and npm (Node Package Manager) installed. Instead of manually installing different Node.js versions and switching between them, we recommend using nvm (Node Version Manager) which allows for easy installation and management of multiple Node.js versions.

  1. Install Homebrew (if you haven’t already…Just go here) for instructions

  2. Install nvm using Homebrew With Homebrew installed, you can now install NVM:

    Terminal window
    brew install nvm
  3. Configure nvm

    Add the following to your shell profile (~/.bash_profile, ~/.zshrc, etc.):

    Terminal window
    export NVM_DIR="$HOME/.nvm"
    [ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"
    [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"

    Then, restart your terminal or run source ~/.bash_profile (or your respective shell profile file).

  4. Install Node.js using nvm

    With nvm configured, you can install the latest version of Node.js:

    Terminal window
    nvm install node
  1. Install Scoop (if not installed… Just go here for instructions)

  2. Install nvm using Scoop

    With Scoop installed, you can install nvm:

    Terminal window
    scoop install nvm
  3. Install Node.js using nvm

    With nvm installed, you can install the latest version of Node.js:

    Terminal window
    nvm install latest

Once you’ve set up nvm, you have access to a variety of commands that help manage your Node.js versions. Below are some basic actions to get you started:

To see a list of Node.js versions you have installed:

Terminal window
nvm list

If you’ve installed multiple versions of Node.js, you can easily switch between them:

Terminal window
nvm use [version]

Replace [version] with the desired version number, e.g., nvm use stable.

Setting a Default Node Version (macOS only)

Section titled “Setting a Default Node Version (macOS only)”

On macOS, you can set a default Node.js version that will be used in any new shell:

Terminal window
nvm alias default [version]

Replace [version] with your preferred version number, e.g., nvm alias default stable.

To set up npm proxy globally, run the following commands:

Terminal window
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

Optionally, you can set up a proxy in your project by creating a .npmrc file at your project root and adding the following:

registry=http://your.internal.registry.org/
sass_binary_site=https://your.internal.binary.sass.site/
strict-ssl=false