Установка
Предварительные условия#
If you don't use the standalone script or @pnpm/exe to install pnpm, then you need to have Node.js (at least v22) to be installed on your system.
инфо
Looking for pnpm 12? It is currently a release candidate and installed differently from pnpm 11. See Installing the pnpm 12 RC.
Using a standalone script#
You may install pnpm even if you don't have Node.js installed, using the following scripts.
На Windows#
warning
Sometimes, Windows Defender may block our executable if you install pnpm this way.
Due to this issue, we currently recommend installing pnpm using npm on Windows.
Using PowerShell:
Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-Expression
On Windows, Microsoft Defender can significantly slow down installation of packages. You can add pnpm to Microsoft Defender's list of excluded folders in a PowerShell window with administrator rights by executing:
Add-MpPreference -ExclusionPath $(pnpm store path)
На POSIX-системах#
Not supported on Intel macOS in pnpm 11
On pnpm 11, the standalone script does not run on Intel Macs (darwin-x64). Use Homebrew, or install pnpm 12, which ships an Intel build. See #11423 for context.
pnpm 12 ships an Intel macOS build again, so this limitation doesn't apply to it.
curl -fsSL https://get.pnpm.io/install.sh | sh -
If you don't have curl installed, you would like to use wget:
wget -qO- https://get.pnpm.io/install.sh | sh -
Linux runtime requirements
The install script picks a glibc or musl build based on your system's libc, and a separate musl build is provided for Alpine and other musl-based distros. The glibc build requires glibc 2.27 or newer plus libatomic.so.1 — both are present on most full distros but may be missing from minimal container images. If you see error while loading shared libraries: libatomic.so.1, install it with your distro's package manager:
- Debian/Ubuntu:
apt-get install -y libatomic1 - Fedora/RHEL:
dnf install -y libatomic
совет
You may use the pnpm runtime command then to install Node.js.
В контейнере Docker#
# 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 -
Установка определенной версии#
Перед запуском скрипта установки вы можете дополнительно установить переменную среды PNPM_VERSION для установки определенной версии pnpm:
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=<version> sh -
Using other package managers#
Using npm#
npx get-pnpm
С помощью Homebrew#
Если на вашем устройстве установлен менеджер пакетов Homebrew, то вы можете установить pnpm следующей командой:
brew install pnpm
Using winget#
Если у вас установлен winget, вы можете установить pnpm, используя следующую команду:
winget install -e --id pnpm.pnpm
Using Scoop#
Если у вас установлен Scoop, вы можете установить pnpm с помощью следующей команды:
scoop install nodejs-lts pnpm
Using Choco#
Если у вас установлен Chocolatey, можно установить pnpm с помощью следующей команды:
choco install pnpm
совет
Хотите использовать pnpm в CI/CD? See: Continuous Integration.
Installing the pnpm 12 RC#
warning
pnpm 12 is a rewrite of pnpm in Rust and is currently a release candidate. Please report any issues you run into.
Apart from a short list of differences, pnpm 12 does not change the way you use pnpm 11, so the rest of this documentation applies to both versions — see What's different in pnpm 12. Only installation differs while v12 is a release candidate: it is published under the next-12 tag on npm and as a prerelease on GitHub, so Homebrew, winget, Scoop and Chocolatey don't offer it yet.
Using pnpm#
If you already have pnpm v11.10.0 or newer, this is the easiest way to switch:
pnpm self-update next-12
pnpm links the native binary directly, so nothing else is needed. Note that inside a project that pins pnpm through the packageManager field, self-update only updates that pin instead of installing pnpm globally.
Using npm#
If you don't have pnpm installed yet:
npx get-pnpm next-12
Node.js 22.13 or newer is needed to run that install script, but not to run pnpm afterwards — pnpm 12 is a native binary.
Using a standalone script#
Set PNPM_VERSION to next-12, or to an exact version.
On POSIX systems:
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=next-12 sh -
On Windows, using PowerShell:
$env:PNPM_VERSION="next-12"; Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-Expression
This installs pnpm without requiring Node.js, and unlike pnpm 11 it also works on Intel macOS.
Совместимость#
Ниже перечислены предыдущие версии pnpm с поддержкой версий Node.js.
| Node.js | pnpm 8 | pnpm 9 | pnpm 10 | pnpm 11 | pnpm 12 |
|---|---|---|---|---|---|
| Node.js 14 | ❌ | ❌ | ❌ | ❌ | ❌ |
| Node.js 16 | ✔️ | ❌ | ❌ | ❌ | ❌ |
| Node.js 18 | ✔️ | ✔️ | ✔️ | ❌ | ✔️ |
| Node.js 20 | ✔️ | ✔️ | ✔️ | ❌ | ✔️ |
| Node.js 22 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Node.js 24 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
| Node.js 26 | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
pnpm 12 only needs Node.js when it is installed from npm; the version installed by the standalone script runs without Node.js.
Решение проблем#
Если pnpm по какой-то причине не работает, и у вас не получается решить проблему переустановив его, возможно вам нужно самостоятельно удалить pnpm и его файлы, определив путь до его папки из переменной окружения PATH.
Например, у вас есть следующая ошибка при запуске pnpm install:
C:\src>pnpm install
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Users\Bence\AppData\Roaming\npm\pnpm-global\4\node_modules\pnpm\bin\pnpm.js'
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
Сначала попробуйте найти местоположение pnpm, запустив: which pnpm. If you're on Windows, run where.exe pnpm.*. Вы получите расположение команды pnpm, например:
$ which pnpm
/c/Program Files/nodejs/pnpm
Теперь, когда вы знаете, где находится CLI pnpm, откройте эту папку и удалите все связанные с pnpm файлы (pnpm.cmd, pnpx.cmd, pnpm и т.д.). После этого установите pnpm еще раз, и он должен работать как вы того ожидаете.
Updating pnpm#
To update pnpm, run the self-update command:
pnpm self-update
Удаление pnpm#
If you need to remove the pnpm CLI from your system and any files it has written to your disk, see Uninstalling pnpm.