Instalação
Pré-requisitos
If you don't use the standalone script or @pnpm/exe
to install pnpm, then you need to have Node.js (at least v16.14) to be installed on your system.
Usando um script autônomo
Você pode usar o pnpm mesmo que você não tenha o Node.js instalando, usando os seguintes scripts.
No Windows
Usando o PowerShell:
$env:PNPM_VERSION = "8.15.7"; iwr https://get.pnpm.io/install.ps1 -useb | iex
Nos sistemas POSIX
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=8.15.7 sh -
Se vocẽ não tiver o curl instalado, você pode usar o wget:
wget -qO- https://get.pnpm.io/install.sh | env PNPM_VERSION=8.15.7 sh -
In a Docker container
# bash
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.bashrc" SHELL="$(which bash)" bash -
# sh
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh -
# dash
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.dashrc" SHELL="$(which dash)" dash -
Instalando uma versão específica
Antes de rodar o script de instalação, você pode, opcionalmente, especificar uma variável de ambiente (. env) PNPM_VERSION
para instalar uma versão específica do pnpm:
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=<version> sh -
Então, você pode utilizar o comando pnpm env para instalar Node.js.
Usando Corepack
Desde a versão v16.13, Node.js inclui Corepack para controlar a instalação de gerenciadores de pacotes. Esta é uma ferramenta experimental, então você precisa habilitá-la com o seguinte comando:
If you have installed Node.js with pnpm env
Corepack won't be installed on your system, you will need to install it separately. See #4029.
corepack enable pnpm
If you installed Node.js using Homebrew, you'll need to install corepack separately:
brew install corepack
This will automatically install pnpm on your system.
You can pin the version of pnpm used on your project using the following command:
corepack use pnpm@latest-8
This will add a "packageManager"
field in your local package.json
which will instruct Corepack to always use a specific version on that project. This can be useful if you want reproducability, as all developers who are using Corepack will use the same version as you. When a new version of pnpm is released, you can re-run the above command.
Usando npm
We provide two packages of pnpm CLI, pnpm
and @pnpm/exe
.
pnpm
is a ordinary version of pnpm, which needs Node.js to run.@pnpm/exe
is packaged with Node.js into an executable, so it may be used on a system with no Node.js installed.
npm install -g pnpm@latest-8
or
npm install -g @pnpm/exe@latest-8
Usando Homebrew
If you have the package manager installed, you can install pnpm using the following command:
brew install pnpm