Перейти до основного змісту
Версія: 11.x

Налаштування

Налаштування pnpm поділяються на дві категорії:

  • Налаштування автентифікації та сертифіката зберігаються у файлах INI. Вони містять конфіденційні облікові дані та не повинні зберігатися у вашому репозиторії. See Authentication Settings for details.
  • All other settings are stored in YAML files: the project pnpm-workspace.yaml and the global config.yaml.

pnpm also no longer reads settings from the pnpm field of package.json. Settings should be defined in pnpm-workspace.yaml.

Конфігурація локального проєкту

Project-level settings go in pnpm-workspace.yaml:

pnpm-workspace.yaml
nodeVersion: "22"
saveExact: true

Глобальні налаштування

The global YAML config file (config.yaml) is located at one of the following paths:

  • If the $XDG_CONFIG_HOME env variable is set, then $XDG_CONFIG_HOME/pnpm/config.yaml
  • On Windows: ~/AppData/Local/pnpm/config/config.yaml
  • On macOS: ~/Library/Preferences/pnpm/config.yaml
  • On Linux: ~/.config/pnpm/config.yaml

The global rc file (for registry and auth settings only) is at:

  • Якщо встановлено змінну середовища $XDG_CONFIG_HOME, тоді $XDG_CONFIG_HOME/pnpm/rc
  • У Windows: ~/AppData/Local/pnpm/config/rc
  • На macOS: ~/Library/Preferences/pnpm/rc
  • В Linux: ~/.config/pnpm/rc

Змінні оточення

Environment variables whose names start with pnpm_config_ are loaded into configuration. These override settings from pnpm-workspace.yaml but not CLI arguments.

попередження

pnpm no longer reads npm_config_* environment variables. Use pnpm_config_* environment variables instead (e.g., pnpm_config_registry instead of npm_config_registry).

Наприклад:

pnpm_config_save_exact=true pnpm add foo

Якщо вам потрібно, щоб pnpm працював на декількох жорстких дисках або файлових системах, прочитайте ЧаПи.

See the config command for more information on managing configuration.