Files
pnpm/pnpm11/docs/cli/setup.md
Zoltan Kochan cb3f29bc0a docs(cli): correct the command reference from install to with (#17251)
Part of pnpm/tasks#191.

Wrong claims, fixed in the v12 docs and, where the same text is wrong
for v11, in the v11 docs:
- logout: drop the nonexistent --scope option.
- patch: the edit dir is node_modules/.pnpm_patches/<name>@<version>;
  drop the "*" special case.
- patch-commit: fix the ---patches-dir heading.
- prefix: describe the real marker walk instead of "closest package.json".
- setup: setup installs pnpm as a global package and writes pn/pnpx/pnx.
- start, test: "run start" and "run test" are not aliases.
- unlink: drop the system-wide and link --global wording.
- unpublish: a package name is required; --otp has no env var; --registry
  wording.
- update: --depth is dependency depth, not directory depth.
- version: --tag-version-prefix defaults to the tagVersionPrefix setting.
- view: the first argument is always the package.
- why: drop --global and --only-projects; --exclude-peers has no effect;
  --prod includes optionalDependencies.
- install: recursiveInstall spelling; replace the stale ci-info snippet.
- v12 only: pack-app runtime default and builder download, pnx
  provisioning list and cmd.exe typo, tasks sample priority.

Missing flags, settings, and error codes on the v12 pages: install (about
twenty flags), lane, licenses, link, list, outdated, owner, pack-app path
rules, pack, patch, patch-remove, peers, permissions, ping, pipeline, pm,
pnx, prune, publish, rebuild, recursive, remove, repo, root, run,
runtime, sbom, search, self-update, set-script, setup, shim, stage, star,
start, store, tasks, team, test, token, unlink, unpublish, update,
version, view, why, with.

Stale history on the v12 pages: removed "Added in" markers older than
v12 and rewrote "Since v11.x" and "In v11" sentences as current behavior
(login, logout, licenses, link, outdated, patch, pnx, publish, runtime,
sbom, self-update, setup, update, and others).

Review follow-up: patch's default edit directory is named after the
argument as typed (both versions); self-update installs the unscoped
package only for pnpm 12 and newer; only --no-bail is restricted;
npm_package_* covers name, version, config, engines and bin; prefix -g
prints the parent of root -g; --optional no longer claims to override
--no-optional.
2026-10-23 00:47:42 +02:00

32 lines
1.5 KiB
Markdown

---
id: setup
title: pnpm setup
---
This command is used by the standalone installation scripts of pnpm. For instance, in [https://get.pnpm.io/install.sh].
Setup does the following actions:
* creates a home directory for the pnpm CLI
* adds the pnpm home directory to the `PATH` by updating the shell configuration file
* when pnpm runs as a standalone executable, installs it as a global package and writes the `pn`, `pnpx`, and `pnx` scripts to `$PNPM_HOME/bin`
If `pnpm setup` cannot tell which shell configuration file to update, for example
in a container where `SHELL` is not set, it still installs pnpm. It then prints the
`PNPM_HOME` and `PATH` lines to add to your shell configuration yourself.
On Windows, if the registry environment values cannot be read or written,
`pnpm setup` still installs pnpm. It prints commands to set `PNPM_HOME` and
`PATH` in the current PowerShell session. Add these commands to your PowerShell
profile to use pnpm in future sessions without registry access.
Since v11.18.0, when running on GitHub Actions, `pnpm setup` also appends `PNPM_HOME` and the global bin directory to the GitHub Actions environment files (`GITHUB_ENV` and `GITHUB_PATH`), so later steps in the same job can run `pnpm add --global` and other global commands.
:::tip
After upgrading to pnpm v11, run `pnpm setup` to update your shell configuration. In v11, globally installed binaries are stored in a `bin` subdirectory of `PNPM_HOME`.
:::
[https://get.pnpm.io/install.sh]: https://get.pnpm.io/install.sh