pnpm install
Apelido: i
O comando yarn install
é usado para instalar todas as dependências de um projeto.
Em um ambiente de CI, a instalação falha se um arquivo de bloqueio estiver presente, mas precisa de uma atualização.
Dentro de um diretório raíz, pnpm install
instala todas as dependências em todos os projetos. Se você deseja desativar esse comportamento, defina a configuração recursive-install
como false
.
TL;DR
Comando | Significado |
---|---|
pnpm i --offline | Instala offline, apenas com os pacotes em cache |
pnpm i --frozen-lockfile | pnpm-lock.yaml não é atualizado |
pnpm i --lockfile-only | Apenas pnpm-lock.yaml é atualizado |
Flags
--offline
- Default: false
- Type: Boolean
If true
, pnpm will use only packages already available in the store. Se um pacote não for encontrado localmente, a instalação falhará.
--prefer-offline
Added in: v1.28.0
- Padrão: low
- Tipo: 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
.
--ignore-scripts
- Padrão: low
- Tipo: Boolean
Do not execute any scripts defined in the project package.json
and its dependencies.
This flag does not prevent the execution of .pnpmfile.cjs
--prod, -P
pnpm will not install any package listed in devDependencies
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 regardless of the NODE_ENV
.
--no-optional
optionalDependencies
are not installed.
--lockfile-only
Added in: v1.26.0 (initially named shrinkwrap-only
)
- Padrão: low
- Tipo: Boolean
When used, only updates pnpm-lock.yaml
and package.json
. Nothing gets written to the node_modules
directory.
--fix-lockfile
Added in: v6.15.0
Fix broken lockfile entries automatically.
--frozen-lockfile
Added in: v1.37.1 (initially named frozen-shrinkwrap
)
- Padrão:
- Fora de CI: false
- Em CI: true, se um lockfile estiver presente
- Tipo: 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.
--reporter=<name>
- Padrão:
- Em stdout TTY: default
- Em stdout não TTY: append-only
- Tipo: default, append-only, ndjson, silent
Allows you to choose the reporter that will log debug info to the terminal about the installation progress.
- silent - nada é enviado ao console, exceto erros fatais
- default - o relator padrão quando o stdout é TTY
- append-only (Adicionado na v1.29.1) - a saída é sempre anexada ao final. O cursor não é manipulado
- ndjson - o relator mais detalhador. Todos os logs sairão no formato ndjson
--use-store-server
Added in: v1.30.0
- Padrão: low
- Tipo: 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
- Padrão: low
- Tipo: Boolean
Creates a flat node_modules
structure, similar to that of npm
or yarn
. WARNING: This is highly discouraged.