zsh-auto-pnpm-use is a Zsh plugin that automatically loads the Node.js version specified in your project using .nvmrc or .npmrc files. It works with PNPM, but requires a specific installation method and some initial setup.
- Uninstall all other Node.js version managers
- Remove NVM, Volta, or any other Node.js version manager from your system. This plugin only works with PNPM's built-in Node.js version management.
- Make sure you do not have conflicting Node.js installations or environment variables.
- Install PNPM using the official curl script
-
You must install PNPM using the method below. Other installation methods (like Homebrew or npm) do not support Node.js version management with
pnpm env use. -
Run this command in your terminal:
curl -fsSL https://get.pnpm.io/install.sh | sh - -
For more details, see the PNPM installation guide.
- Restart your terminal
- After installing PNPM, close and reopen your terminal to ensure the
pnpmcommand is available.
- Clone the plugin into your Oh My Zsh custom plugins directory:
git clone https://github.com/brunomacedo/zsh-auto-pnpm-use ~/.oh-my-zsh/custom/plugins/zsh-auto-pnpm-use- Enable the plugin in your
.zshrcfile:
Open your ~/.zshrc and add zsh-auto-pnpm-use to the plugins list:
plugins=(
# other plugins
zsh-auto-pnpm-use
)- Reload your Zsh configuration:
source ~/.zshrcOn the first terminal session after installing the plugin, the PNPM configuration for Node.js versions may not exist yet. Initialize it manually:
- Set PNPM's default Node.js version (the plugin uses
default-node-version):
pnpm config set default-node-version "$(node --version)"- Open a new terminal or run
source ~/.zshrcagain.
When you enter a directory, the plugin checks for a .nvmrc file:
- If
.nvmrcexists, it uses the Node.js version specified in that file. - If no
.nvmrcis present, it falls back to PNPM'sdefault-node-versionsetting.
Note: the plugin currently does not parse node-version from .npmrc files.
25.7.0
- Make sure you do not have NVM or other Node.js managers installed.
- Only the PNPM installed via the official curl script supports Node.js version management.
- If you see errors about missing Node.js versions, check your
.nvmrcfile and your PNPM config.
To remove the plugin, delete the plugin directory and remove it from your .zshrc plugins list.
For more information, see the PNPM documentation.