Environment
vp env manages the complete JavaScript environment: one Node.js runtime and one selected package manager. npm, pnpm, Yarn, and Bun are peer package-manager families.
Overview
Managed mode is on by default, so Node.js and package-manager shims resolve through Vite+ and pick the right versions for the current project.
Most commands operate on both components when no selector is given. Add node, pm, npm, pnpm, yarn, or bun to narrow the command. pm means all four families for listing and cleanup, but the single selected package manager for project operations.
Unqualified versions remain Node.js versions for compatibility:
vp env pin 22.0.0 # Node.js only
vp env pin pnpm@10.18.0 # pnpm only
vp env pin 22.0.0 pnpm@10.18.0 # Both componentsVite+ checks the current directory first, then walks up through its parents. The nearest directory with a supported declaration wins. Within each directory, sources are checked in this order:
.node-versionfiledevEngines.runtimeinpackage.json(the devEngines standard)engines.nodeinpackage.json.nvmrcfile
If no directory declares a version, Vite+ uses the global default (vp env default) and then the latest LTS.
devEngines.runtime ranks above engines.node because it declares the development-environment requirement, while engines.node is a consumer-facing support range. vp env doctor warns when declared sources conflict.
Package-manager selection uses this priority:
- Explicit command override
VP_PACKAGE_MANAGERor the shell-session override- Top-level
packageManager devEngines.packageManager- Lockfile or manager-specific configuration
- The global package-manager default
- The named shim's latest release
A selected manager controls only its named shims. For example, pnpm controls pnpm and pnpx; invoking npm still resolves npm independently. Alias pairs are npm/npx, pnpm/pnpx, yarn/yarnpkg, and bun/bunx. Without a package-manager selection, invoking pnpm, yarn, or bun uses the latest release without prompting. The resolved version is cached for one hour and an expired cache remains available when the registry cannot be reached. npm instead falls back to the version bundled with the resolved Node.js runtime.
By default, Vite+ stores its managed runtime and related files in ~/.vite-plus. If needed, you can override that location with VP_HOME.
If you want to keep that behavior, run:
vp env onThis enables managed mode for both components. Their modes can also be changed independently:
vp env on node
vp env off pmIf you do not want Vite+ to manage Node.js first, run:
vp env offThis switches both components to system-first mode. Vite+ prefers system tools and falls back to managed installations. Mixed configurations compose: a system package-manager launcher receives the Node.js selected by the Node mode.
Commands
Setup
vp env setupcreates or updates thenode,npm,npx,pnpm,pnpx,yarn,yarnpkg,bun,bunx,vpx, andvprshims inVP_HOME/bin(and writes the per-shell setup scripts underVP_HOME)vp env on/vp env offchanges both modes; appendnodeorpmto change onevp env printprints PATH setup for both components; append a selector to print one
PowerShell needs to dot-source the generated setup script in the current shell before vp env use can affect only that shell session:
. "$env:USERPROFILE\.vite-plus\env.ps1"Add that line to the end of your PowerShell $PROFILE to apply it automatically in new shells. It does not require elevated privileges.
Create the profile file if it does not already exist:
if (-not (Test-Path $PROFILE)) { New-Item $PROFILE -Force }Open the profile file for editing:
Invoke-Item $PROFILEWindows Command Prompt (cmd.exe) cannot define the wrapper function needed for vp env use to update the current shell session. Use the generated vp-use.cmd command instead:
vp-use 20
node --version
vp-use --unsetOnly vp env use needs this alternate command. Other vp env commands work normally in Command Prompt. vp env setup creates vp-use.cmd under VP_HOME/bin on Windows.
In CI, vp env use can still run without shell initialization. It writes temporary Node.js and package-manager session files under VP_HOME so later shim calls in the same job resolve the same environment.
Manage
vp env defaultshows both global defaults. Bare versions set Node.js; qualified specs such aspnpm@10.18.0set the PM fallback.--unsetclears both unless scoped.vp env pinshows or writes project pins. Existing.node-versionand top-levelpackageManagerfields keep being updated for compatibility; otherwise Vite+ writes the matchingdevEnginesentry. Use--target node-version,--target dev-engines, or--target package-managerto choose explicitly.vp env unpinremoves both effective pins by default; append a selector to remove one. Lower-priority declarations are not deleted.vp env useactivates the complete project environment. Explicit specs override selected components;--unsetclears both unless scoped.vp env installinstalls the complete resolved environment, a selected component, or explicit specs.vp env uninstallremoves explicit exact Node.js or qualified package-manager versions.vp env cleanremoves unused installs. Useclean node,clean pm, or a concrete manager. Current and configured-default versions are preserved.vp env execruns a command in the resolved environment. Use--nodeand--package-manager;--npmis an alias for--package-manager npm@….vp nodeuses the resolved Node.js runtime and exposes the selected package-manager path to child processes.
Inspect
vp env currentshows the current resolved environmentvp env doctorruns environment diagnosticsvp env whichshows which tool path will be usedvp env listshows separate Node.js, npm, pnpm, Yarn, and Bun sections; selectors narrow outputvp env list-remotefetches Node.js and all four PM registries concurrently; selectors narrow network work.--ltsimplicitly selects Node.js.
Project Setup
- Pin a project version with
vp env pin - Use
vp install,vp dev, andvp buildnormally - Let Vite+ pick the right runtime for the project
Examples
# Setup
vp env setup # Create Node.js and package-manager shims
vp env on # Manage Node.js and package managers
vp env off pm # Prefer system package managers only
vp env print # Print PATH setup for both components
# Manage
vp env pin lts pnpm@10 # Pin both project components to exact versions
vp env install # Install the complete resolved environment
vp env default lts # Set the global Node.js default
vp env default pnpm@10 # Set the global package-manager fallback
vp env use 20 pnpm@10 # Override both components for this shell
vp env use --unset pm # Remove only the PM session override
vp env clean yarn # Remove unused managed Yarn versions
# Inspect
vp env current # Show current resolved environment
vp env current --json # JSON output for automation
vp env which node # Show which node binary will be used
vp env which npx # Show pinned package-manager alias when packageManager matches
vp env list # Show every locally installed component
vp env list node # Show only Node.js installations
vp env list-remote --lts # List only Node.js LTS versions
# Execute
vp env exec --node lts --package-manager pnpm@10 pnpm install
vp env exec node -v # Use shim mode with automatic version resolution
vp node script.js # Shorthand: run a Node.js script with the resolved version
vp node -e "console.log(1+1)" # Shorthand: forward any node flag or argumentJSON output
This release intentionally changes the JSON contracts for current, list, and list-remote. current --json returns peer component objects:
{
"node": {
"version": "22.0.0",
"source": "devEngines.runtime",
"source_path": "/project/package.json",
"project_root": "/project",
"bin_path": "/home/.vite-plus/js_runtime/node/22.0.0/bin/node",
"installed": true,
"mode": "managed"
},
"package_manager": {
"name": "pnpm",
"version": "10.18.0",
"source": "packageManager",
"source_path": "/project/package.json",
"project_root": "/project",
"bin_paths": {
"pnpm": "/home/.vite-plus/package_manager/pnpm/10.18.0/pnpm/bin/pnpm",
"pnpx": "/home/.vite-plus/package_manager/pnpm/10.18.0/pnpm/bin/pnpx"
},
"installed": true,
"mode": "managed"
}
}list --json and list-remote --json group the component arrays:
{
"node": [],
"package_managers": {
"npm": [],
"pnpm": [],
"yarn": [],
"bun": []
}
}Selectors omit unselected top-level fields or PM families. Registry listing is all-or-error: Vite+ prints no partial human or JSON result when any selected registry request fails.
Custom Node.js Mirror
By default, Vite+ downloads Node.js from https://nodejs.org/dist. If you're behind a corporate proxy or need to use an internal mirror (e.g., Artifactory), set the VP_NODE_DIST_MIRROR environment variable:
# Install a specific version from your custom mirror
VP_NODE_DIST_MIRROR=https://my-mirror.example.com/nodejs/dist vp env install 22
# Set the global default version using a custom mirror
VP_NODE_DIST_MIRROR=https://my-mirror.example.com/nodejs/dist vp env default lts
# Set it permanently in your shell profile (.bashrc, .zshrc, etc.)
echo 'export VP_NODE_DIST_MIRROR=https://my-mirror.example.com/nodejs/dist' >> ~/.zshrcNode.js Signature Verification
When installing Node.js from the official nodejs.org distribution, Vite+ downloads the PGP-signed SHASUMS256.txt.asc and verifies it against the bundled Node.js release keys before trusting any checksum. This protects against a tampered SHASUMS256.txt paired with a matching malicious archive. The SHA-256 checksum of the downloaded archive is always verified afterward.
Custom mirrors (VP_NODE_DIST_MIRROR) that publish only the plain SHASUMS256.txt fall back to checksum-only verification. A mirror that does publish a .asc still has its signature verified, and an invalid signature is a hard error.
If a future keyring or certificate issue blocks downloads, set VP_NODE_SKIP_SIGNATURE_VERIFY to temporarily bypass PGP verification. The SHA-256 checksum is still verified, and Vite+ prints a warning when the signature check is skipped:
VP_NODE_SKIP_SIGNATURE_VERIFY=1 vp env install 22