CLI & Node.js Settings

Параметри CLI#

[no-]color#

  • Стандартно: auto
  • Тип: auto, always, never

Керує кольорами у виводі.

  • auto — вивід використовує кольори, коли стандартним виводом є термінал або TTY.
  • always — ігнорувати різницю між терміналами та конвеєрами. You'll rarely want this; in most scenarios, if you want color codes in your redirected output, you can instead pass a --color flag to the pnpm command to force it to use color codes. The default setting is almost always what you'll want.
  • never — вимикає кольори. Цей параметр використовується для --no-color.

loglevel#

  • Стандартно: info
  • Тип: debug, info, warn, error

Будуть показані всі журнали вказаного рівня або вище. Замість цього ви можете передати --silent, щоб вимкнути всі журнали виводу.

reporter#

Selects the log reporter. See --reporter for the available reporters and terminal-dependent defaults.

useBetaCli#

  • Стандартно: false
  • Тип: Boolean

Експериментальна опція, яка дозволяє використовувати бета-функції CLI. Це означає, що ви можете отримати деякі зміни у функціоналі CLI, які є порушеннями або потенційними помилками.

recursiveInstall#

  • Стандартно: true
  • Тип: Boolean

Якщо цей параметр увімкнено, основною поведінкою pnpm install стане поведінка pnpm install -r, тобто встановлення буде виконано до всіх пакунків робочого простору або вкладених тек.

Інакше, pnpm install збиратиме пакунок виключно у поточній теці.

engineStrict#

  • Стандартно: false
  • Тип: Boolean

Якщо цей параметр увімкнено, pnpm не встановлюватиме пакунки, які стверджують, що вони несумісні з поточною версією Node.

Незалежно від цієї конфігурації, встановлення завжди завершиться невдачею, якщо проєкт (не залежність) вкаже несумісну версію у своєму полі engines.

npmPath#

  • Тип: path

Розташування бінарного файлу npm, який pnpm використовує для деяких дій, таких як публікація.

pmOnFail#

Додано у: v11.0.0

  • Стандартно: download
  • Тип: download, error, warn, ignore

Overrides the onFail behavior of both the packageManager field and devEngines.packageManager when the running pnpm version does not match the declared one.

  • download: download and run the declared pnpm version (this is the default and matches the previous managePackageManagerVersions: true behavior).
  • error: fail the command (equivalent to the previous packageManagerStrictVersion: true).
  • warn: print a warning but continue (equivalent to the previous packageManagerStrict: false or COREPACK_ENABLE_STRICT=0).
  • ignore: skip the check entirely (equivalent to the previous managePackageManagerVersions: false). Useful when version management is handled by an external tool such as asdf, mise, or Volta.

A part of the configuration pnpm cannot read does not stop it from switching to the declared pnpm version, which reads the configuration itself. pnpm leaves out the file or setting it cannot read, and every other source still applies, so it switches only when the pmOnFail from the environment or a readable file is download.

Can be set via CLI flag, environment variable, or pnpm-workspace.yaml:

pnpm install --pm-on-fail=ignore
pnpm_config_pm_on_fail=ignore pnpm install
pnpm-workspace.yaml
pmOnFail: ignore

This setting replaces the removed managePackageManagerVersions, packageManagerStrict, and packageManagerStrictVersion settings, as well as the COREPACK_ENABLE_STRICT environment variable.

Migration:

Removed setting Змінено на
managePackageManagerVersions: true pmOnFail: download (стандартно)
managePackageManagerVersions: false pmOnFail: ignore
packageManagerStrict: false pmOnFail: warn
packageManagerStrictVersion: true pmOnFail: error
COREPACK_ENABLE_STRICT=0 pmOnFail: warn

See also pnpm with for running pnpm at a specific version without changing this setting.

Node.js settings#

nodeVersion#

  • Стандартно: значення, що повертається node -v, без префікса v
  • Тип: точна версія semver (не діапазон)

Версія Node.js, яку слід використовувати при перевірці параметра engines пакунка.

Якщо ви хочете заборонити учасникам вашого проєкту додавати нові несумісні залежності, використовуйте nodeVersion та engineStrict у файлі pnpm-workspace.yaml у корені проєкту:

pnpm-workspace.yaml
nodeVersion: 12.22.0
engineStrict: true

This way, even if someone is using Node.js v22, they will not be able to install a new dependency that doesn't support Node.js v12.22.0.

runtimeOnFail#

Додано у: v11.0.0

  • Стандартно: undefined
  • Тип: download, error, warn, ignore

Overrides the onFail field of devEngines.runtime (and engines.runtime) in the root project's package.json. This is useful when you want a different local behavior than what is written in the manifest, for instance, forcing pnpm to download the declared runtime even when the manifest sets onFail: "warn":

pnpm-workspace.yaml
runtimeOnFail: download

nodeDownloadMirrors#

Додано у: v11.0.0

  • Стандартно: undefined
  • Тип: Record<string, string>

Налаштуйте власні дзеркала завантаження Node.js у pnpm-workspace.yaml. Ключі — це канали релізів (release, rc, nightly, v8-canary тощо), а значення — URL-адреси.

Ось як можна налаштувати pnpm для завантаження Node.js з дзеркала Node.js в Китаї:

pnpm-workspace.yaml
nodeDownloadMirrors:
  release: https://npmmirror.com/mirrors/node/
  rc: https://npmmirror.com/mirrors/node-rc/
  nightly: https://npmmirror.com/mirrors/node-nightly/

Since v11.26.0, downloads from a mirror carry the npm registry credentials configured for that URL, including bearer tokens, basic auth, and tokenHelper, so a mirror behind an authenticating proxy works without a separate credential.