Installing Node.js

Caplin Trader’s build stack runs on Node.js. This page provides guidance on installing Node.js on Microsoft Windows, Apple macOS, and Linux.

These instructions are for installing a single version of Node.js. For advanced installations that manage multiple versions of Node.js, see Using a version manager to install Node.js and npm.

Requirements

For the full Caplin Trader 5 requirements, see Caplin Trader 5 requirements.

Installing Node.js on Microsoft Windows

For the Node.js installer, see Node.js Downloads on the Node.js website.

To install the build environment required to build native Node.js modules, see Compiling native AddOn modules in the Microsoft Node.js Guidelines.

Installing Node.js on macOS

We recommend installing Node.js using Homebrew.

The Homebrew package for Node.js automatically configures the npm package manager to install global packages to a location under your home directory (see npm’s prefix variable).

Installing Node.js on Linux

Your Linux distribution’s software repository probably already has a version of Node.js that you can download, but to get access to the latest version we recommend that you install Node.js using one of the following methods:

Setting up a build environment for native modules

Some packages in the npm repository contain C source code that requires compilation during package installation.

To set up a build environment, run one of the commands below:

Red Hat Enterprise Linux 7 and variants
$ sudo yum group install "Developer Tools"
The mandatory packages in the "Developer Tools" group will already be installed if you selected the option "Development and Creative Workstation" during installation.
Ubuntu and variants
$ sudo apt install build-essential

Configuring the installation location for global packages

This section applies if you install Node.js using a DEB or RPM package from the nodesource.com repositories (Installing Node.js via package manager).

The DEB and RPM packages for Node.js in the nodesource.com repositories are drop-in replacements for your system’s Node.js package. Global Node.js packages for your system are stored under the /usr directory and should be managed by your system’s package manager, not npm. As a software developer, you need more flexibility than this.

To change where npm installs global packages for your user account, and allow you to use npm to manage global Node.js packages, follow the steps below:

  1. Create the directory ~/.npm-global:

    mkdir ~/.npm-global
  2. Run the command below to configure npm to use ~/.npm-global as the location for global packages:

    npm config set prefix ~/.npm-global
  3. Add the following lines to your ~/.profile file:

    export NPM_CONFIG_PREFIX=$HOME/.npm-global
    PATH="${NPM_CONFIG_PREFIX}/bin:$PATH"
  4. Log out and log back in

  5. Run the command below to test that npm will install global packages to ~/.npm-global:

    $ npm config get prefix
    /home/jsmith/.npm-global