Перейти к основному содержимому
Версия: Next

pnpm install

Алиасы: i

pnpm install используется для установки всех зависимостей проекта.

В среде CI установка завершается неудачно, если присутствует локфайл, но требуется его обновление.

Внутри воркспейса, pnpm install устанавливает все зависимости во всех проектах. Если вы хотите отключить это поведение, задайте для recursive-install значение false.

TL;DR

КомандаОбозначение
pnpm i --offlineУстановить офлайн, используя только хранилище (CAS)
pnpm i --frozen-lockfilepnpm-lock.yaml не будет обновлён
pnpm i --lockfile-onlyТолько pnpm-lock.yaml будет обновлён

Опции

--force

Force reinstall dependencies: refetch packages modified in store, recreate a lockfile and/or modules directory created by a non-compatible version of pnpm. Install all optionalDependencies even they don't satisfy the current environment(cpu, os, arch).

--offline

  • По умолчанию: false
  • Тип: Boolean

If true, pnpm will use only packages already available in the store. If a package won't be found locally, the installation will fail.

--prefer-offline

  • По умолчанию: false
  • Тип: Boolean

If true, staleness checks for cached data will be bypassed, but missing data will be requested from the server. To force full offline mode, use --offline.

--prod, -P

pnpm will not install any package listed in devDependencies and will remove those insofar they were already installed, if the NODE_ENV environment variable is set to production. Use this flag to instruct pnpm to ignore NODE_ENV and take its production status from this flag instead.

--dev, -D

Only devDependencies are installed and dependencies are removed insofar they were already installed, regardless of the NODE_ENV.

--no-optional

optionalDependencies are not installed.

--lockfile-only

  • По умолчанию: false
  • Тип: Boolean

When used, only updates pnpm-lock.yaml and package.json. Nothing gets written to the node_modules directory.

--fix-lockfile

Fix broken lockfile entries automatically.

--frozen-lockfile

  • По умолчанию:
    • Для не-CI: false
    • Для CI: true, если присутствует lockfile
  • Тип: Boolean

If true, pnpm doesn't generate a lockfile and fails to install if the lockfile is out of sync with the manifest / an update is needed or no lockfile is present.

This setting is true by default in CI environments. The following code is used to detect CI environments:

https://github.com/watson/ci-info/blob/44e98cebcdf4403f162195fbcf90b1f69fc6e047/index.js#L54-L61
exports.isCI = !!(
env.CI || // Travis CI, CircleCI, Cirrus CI, GitLab CI, Appveyor, CodeShip, dsari
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
env.BUILD_NUMBER || // Jenkins, TeamCity
env.RUN_ID || // TaskCluster, dsari
exports.name ||
false
)

--reporter=<название>

  • По умолчанию:
    • Для TTY stdout: default
    • Для не-TTY stdout: append-only
  • Тип: default, append-only, ndjson, silent

Allows you to choose the reporter that will log debug info to the terminal about the installation progress.

  • silent - в консоль не записывается вывод, даже критические ошибки
  • default - отчёт по умолчанию, когда stdout - TTY
  • append-only - вывод всегда добавляется в конец. Манипуляции с курсором не выполняются
  • ndjson - наиболее подробный репортер. Выводит все журналы в формате ndjson

If you want to change what type of information is printed, use the loglevel setting.

--use-store-server

  • По умолчанию: false
  • Тип: Boolean

Starts a store server in the background. The store server will keep running after installation is done. To stop the store server, run pnpm server stop

--shamefully-hoist

  • По умолчанию: false
  • Тип: Boolean

Creates a flat node_modules structure, similar to that of npm or yarn. WARNING: This is highly discouraged.

--ignore-scripts

  • По умолчанию: false
  • Тип: Boolean

Не выполнять скрипты, определенные в package.json в корне проекта и в его зависимостях.

--filter <селектор пакета>

Подробнее о фильтрации.