Yarn config file locations
Commands use a POSIX shell (macOS, Linux, or WSL). Install the named editor or CLI first. Before using an environment-variable path, check that the variable is set to a non-empty, intended path. When using vi or Notepad, ensure the parent directory exists and is writable. A missing file is created when you save it; Notepad may ask to create it.
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.
Project level
Project overridesUsually kept at the project root. Run commands from the project root.
Config file location
Use YAML syntax and the .yml extension. Modern Yarn does not use .npmrc for its settings.<project>/.yarnrc.ymlCommands
vi "./.yarnrc.yml"Parent directories
Inherited settingsYarn also reads configuration files in ancestor directories. Closer files take precedence for the same setting.
Config file location
Replace <parent> with an actual ancestor directory. More than one ancestor can provide settings.<parent>/.yarnrc.ymlReplace <parent> with the ancestor directory whose Yarn settings you intend to edit before running. Keep the surrounding quotes for paths containing spaces.
Command templates
vi "<parent>/.yarnrc.yml"User level
User defaultsUser defaults stored in the home directory.
Config file location
The file may not exist until you create home configuration.~/.yarnrc.ymlCommands
vi "$HOME/.yarnrc.yml"
Inspect configuration
yarn configOfficial Yarn documentation