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.
Project level
Project overridesUsually kept at the project root. Replace <project> with your project directory.
Config file location
Use YAML syntax and the .yml extension. Modern Yarn does not use .npmrc for its settings.<project>/.yarnrc.ymlCommands
vi "<project>/.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.ymlCommands
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