Resolve the Node.js `latest` selector to the newest stable entry of the release index. When the index has no stable entry, which is what the nightly, rc, and other prerelease channel indexes look like, fall back to the first entry, so `node@nightly` keeps resolving to the newest nightly build. The fallback keeps the exported resolveNodeVersion/resolveNodeVersions contract intact: callers that pass a prerelease mirror URL without a release channel still get a version for `latest`. Closes pnpm/pnpm#17490 --------- Co-authored-by: Zoltan Kochan <z@kochan.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1.7 KiB
id, title
| id | title |
|---|---|
| env | pnpm env <cmd> |
:::warning Deprecated
pnpm env is deprecated. Use pnpm runtime instead. For example, pnpm env use --global lts becomes pnpm runtime set node lts -g.
:::
Manages the Node.js environment.
Commands
use
Install and use the specified version of Node.js
Install the LTS version of Node.js:
pnpm env use --global lts
Install Node.js v16:
pnpm env use --global 16
Install a prerelease version of Node.js:
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 stable version of Node.js:
pnpm env use --global latest
Install an LTS version of Node.js using its codename:
pnpm env use --global argon
remove, rm
Removes the specified versions of Node.js.
Usage example:
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.
pnpm env list
Print the available Node.js v16 versions:
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.