Config File Locator

Yarn config file locations

Find Yarn Modern configuration file locations and precedence on macOS, Linux, and Windows.


This page covers Yarn Modern (2+). Yarn reads .yarnrc.yml in the current directory and its ancestors, with nearer files overriding the same settings farther up the tree; the home configuration supplies user defaults. Environment variables can override file settings. Yarn Classic (1.x) uses .yarnrc and is not covered here. YARN_RC_FILENAME can change the filename searched for.

  1. Project level

    Project overrides

    Usually kept at the project root. Replace <project> with your project directory.

    Config file location
    <project>/.yarnrc.yml
    Use YAML syntax and the .yml extension. Modern Yarn does not use .npmrc for its settings.
    Commands
    vi "<project>/.yarnrc.yml"
  2. Parent directories

    Inherited settings

    Yarn also reads configuration files in ancestor directories. Closer files take precedence for the same setting.

    Config file location
    <parent>/.yarnrc.yml
    Replace <parent> with an actual ancestor directory. More than one ancestor can provide settings.
    Commands
    vi "<parent>/.yarnrc.yml"
  3. User level

    User defaults

    User defaults stored in the home directory.

    Config file location
    ~/.yarnrc.yml
    The file may not exist until you create home configuration.
    Commands
    vi "$HOME/.yarnrc.yml"

Inspect configuration
yarn config

Official Yarn documentation