Part of pnpm/tasks#191. Wrong claims, fixed on the v12 page and on the v11 twin where it had the same text: - audit: `--interactive` implies `--fix=override`; `info` is a valid audit level. - change check validates the pending intents. - deploy copies the publish packlist unless `deployAllFiles` is set. - deprecate: an empty message fails, use `pnpm undeprecate`. - deprecate, dist-tag: only `--otp` supplies the one-time password. - dist-tag add defaults to `latest`, not the `tag` setting. - docs takes exactly one package. - env: there is no `add` subcommand, and `list` queries the Node.js mirror only. - v12 only: clean no longer says it uses Node.js, add no longer presents `-w` as an alias, the deploy package-manager-pin history is no longer contradictory, doctor sample shows store v11. Missing facts: - add: `--save-prefix`, `--save-build`, `--no-save-peer`, `--no-save-types`, `--lockfile-only`, `--force`; where Yarn vs npm and Bun pins go; catalog and configDependencies links. - access status shorthands; approve-builds error codes, the placeholder value and the immediate rebuild; audit exit code, `--optional`, `--production`, and how to make `--ignore` write `audit.ignore`; `--ignore` exits with code 0 and `--ignore-unfixable` fails on an advisory without a GHSA ID. - bugs and docs `--registry`; ci accepts install options; clean script override and modulesDir; config `--location` type and `get` output; create name mapping, `--shell-mode`, `--cpu`, `--os`, `--libc`; dedupe flags; deploy error codes and Dockerfile WORKDIR; dist-tag aliases and web OTP; env `--global` requirement; exec recursive options and PNPM_PACKAGE_NAME; fetch `--ignore-pnpmfile`, lockfile requirement, optional pnpmfile in the Dockerfiles. - usage, examples, and output for bin, cache, cache list, cache delete (with the no-argument warning), cache view, cat-file, cat-index, find-hash, ignored-builds, import, and init (`initPackageManager`, `initType`, ERR_PNPM_PACKAGE_JSON_EXISTS). Stale history on v12 pages: removed "Added in" markers for v10 and v11 and rewrote "Since v11..." passages as current behavior in access, add, approve-builds, audit, bugs, cache-list-registries, cache-path, cache-prune, change, ci, config, create, deploy, deprecate, dist-tag, docs, doctor, help, ignored-builds, and init. Review follow-up: cat-file now says it rejects the hex digest that cat-index prints; the settings index links initPackageManager and initType; `change check` says it plans the release without reporting it (both versions); `pnpm bin` follows a custom modulesDir.
88 lines
1.7 KiB
Markdown
88 lines
1.7 KiB
Markdown
---
|
|
id: env
|
|
title: "pnpm env <cmd>"
|
|
---
|
|
|
|
:::warning Deprecated
|
|
|
|
`pnpm env` is deprecated. Use [`pnpm runtime`](./runtime.md) instead. For example, `pnpm env use --global lts` becomes `pnpm runtime set node lts -g`.
|
|
|
|
:::
|
|
|
|
Manages the Node.js environment.
|
|
|
|
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/84-MzN_0Cng" title="The pnpm patch command demo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen"></iframe>
|
|
|
|
|
|
## Commands
|
|
|
|
### use
|
|
|
|
Install and use the specified version of Node.js
|
|
|
|
Install the LTS version of Node.js:
|
|
|
|
```sh
|
|
pnpm env use --global lts
|
|
```
|
|
|
|
Install Node.js v16:
|
|
|
|
```sh
|
|
pnpm env use --global 16
|
|
```
|
|
|
|
Install a prerelease version of Node.js:
|
|
|
|
```sh
|
|
pnpm env use --global nightly
|
|
pnpm env use --global rc
|
|
pnpm env use --global 16.0.0-rc.0
|
|
pnpm env use --global rc/14
|
|
```
|
|
|
|
Install the latest version of Node.js:
|
|
|
|
```sh
|
|
pnpm env use --global latest
|
|
```
|
|
|
|
Install an LTS version of Node.js using its [codename]:
|
|
|
|
```sh
|
|
pnpm env use --global argon
|
|
```
|
|
|
|
[codename]: https://github.com/nodejs/Release/blob/main/CODENAMES.md
|
|
|
|
### remove, rm
|
|
|
|
Removes the specified versions of Node.js.
|
|
|
|
Usage example:
|
|
|
|
```sh
|
|
pnpm env remove --global 14.0.0
|
|
pnpm env remove --global 14.0.0 16.2.3
|
|
```
|
|
|
|
### list, ls
|
|
|
|
Print the Node.js versions available from the Node.js mirror that match a version range. Without a range, only the newest version is printed.
|
|
|
|
```sh
|
|
pnpm env list
|
|
```
|
|
|
|
Print the available Node.js v16 versions:
|
|
|
|
```sh
|
|
pnpm env list 16
|
|
```
|
|
|
|
## Options
|
|
|
|
### --global, -g
|
|
|
|
The changes are made systemwide. `use` and `remove` require this option. Without it, they fail with `ERR_PNPM_NOT_IMPLEMENTED_YET`.
|