Installing Yarn

This page describes how to install the Yarn package manager, used as an alternative to npm for managing dependencies in Caplin Trader 5 projects. There is a known issue in versions of npm later than 4 that prevents npm from working with Caplin Trader 5 projects.

Requirements

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

Installing Yarn

To install Yarn, follow the steps below:

  1. Install Node.js, if you have not done so already. See Installing Node.js.

  2. Run the command below to check that npm is configured to install global packages under your home directory:

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

    If the above command does not return a location under your home directory, follow the instructions in Configuring the installation location for global packages.

    Most Node.js installation methods configure npm to install global packages under your home directory. The exceptions are the DEB and RPM packages hosted by nodesource.com, which are drop-in replacements for your Linux system’s Node.js package.
  3. Run the command below to install Yarn as a global package:

    $ npm install -g yarn
  4. Run the command below to check that Yarn is configured to install global Node.js packages to the same location that npm does:

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

    If the locations these commands return are different, run the command below to correct it:

    $ yarn config set prefix "$(npm config get prefix)"