
Company News
Socket Partners with Replit to Block Malicious Packages in AI-Powered Development
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.
@jchip/nvm
Advanced tools
A universal node.js version manager for Windows (no admin) and Unix.
Install is simple with a PowerShell script on Windows, or a bash script on Unix.
No admin required on Windows to install or use.
A linked system wide version that can be changed any time.
Change to any version independently in a terminal any time.
You don't need admin rights to install or use, only the permission to execute PowerShell scripts.
Tested on Windows 10, 8.1, and 7. Windows 7 requires PowerShell updates, see update instructions.
To install, start a Windows PowerShell and copy and paste one of the scripts below into the shell terminal and press enter.
This will install nvm and current LTS Node.js (v12.13.0) to directory nvm under your home specified by $Env:USERPROFILE.
If you want to install this under another directory, then set it with the param -nvmhome.
If you don't set it, then $Env:NVM_HOME will be checked, and if non-existent, then a Directory Browser dialog will be opened for you to create and choose a directory.
Video Demo of upgrading Windows 7 to PowerShell 5.1 and then installing this
You can retrieve the install script from multiple sources. Listed below are three options for you to choose from in case one of them is down.
Retrieve install script from github.com directly:
cd $Env:USERPROFILE;
Invoke-WebRequest https://raw.githubusercontent.com/jchip/nvm/v1.9.0/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
del install.ps1
Retrieve install script from unpkg.com:
cd $Env:USERPROFILE;
Invoke-WebRequest https://unpkg.com/@jchip/nvm@1.9.0/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
del install.ps1
Retrieve install script from jsdelivr.net:
cd $Env:USERPROFILE;
Invoke-WebRequest https://cdn.jsdelivr.net/npm/@jchip/nvm@1.9.0/install.ps1 -OutFile install.ps1;
.\install.ps1 -nvmhome $Env:USERPROFILE\nvm;
del install.ps1
PowerShell version 4+ is required.
For Windows 7, you can update it to version 5.1 with the following instructions:
Win7AndW2K8R2-KB3191566-x64.zip or Win7-KB3191566-x86.zip for 32-bitWin7AndW2K8R2-KB3191566-x64.msu or Win7-KB3191566-x86.msu for 32-bitAfter it's completed and rebooted, launch PowerShell and type $PSVersionTable to check.
PSVersion should be something like
5.1.#####.####
Video Demo of upgrading Windows 7 to PowerShell 5.1 and then installing this
If you get the error:
install.ps1 cannot be loaded because running scripts is disabled on this system.
Then you need to set execution policy for PowerShell to RemoteSigned with the command:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
See this StackOverflow question for details.
You need to keep this policy if you want to use nvm in PowerShell to switch node.js versions.
If for some reason you absolutely can't have PowerShell or permission to install from it, then you can try to manually install following these steps:
nvm-1.9.0.nvm, for example: C:\Users\<username>\nvmC:\Users\<username>\nvm. You will get a new directory node-v20.12.1-win-x64node.exe from that directory into C:\Users\<username>\nvmRegEdit.exe, in HKEY_CURRENT_USER/Environment
NVM_HOME -> C:\Users\<username>\nvmNVM_LINK -> C:\Users\<username>\nvm\nodejs\binPath
;C:\Users\<username>\nvm\bin;C:\users\<username>\nvm\nodejs\binnvm install lts, note the version installed, and then nvm link <version>.Make sure to replace <username> above with your actual user name.
If you want to use Universal NVM with Git Bash after installing on Windows via PowerShell:
$NVM_HOME/bin/nvm-setup.sh
source ~/.bashrc
Now you can use nvm commands in Git Bash just like on Unix systems.
Because this is implemented in node.js, it happens to work on Unix also. It just need a different install script using bash.
To retrieve and run the install script, provided below are three options for you to choose from in case one of them is down.
Please pick one and then copy and paste it into a bash terminal to run.
Retrieve the install script from github.com:
Using cURL and the install script:
export NVM_HOME=~/nvm; curl -o- https://raw.githubusercontent.com/jchip/nvm/v1.9.0/install.sh | bash
or wget:
export NVM_HOME=~/nvm; wget -qO- https://raw.githubusercontent.com/jchip/nvm/v1.9.0/install.sh | bash
Retrieve the install script from unpkg.com:
Using cURL and the install script:
export NVM_HOME=~/nvm; curl -o- https://unpkg.com/@jchip/nvm@1.9.0/install.sh | bash
or wget:
export NVM_HOME=~/nvm; wget -qO- https://unpkg.com/@jchip/nvm@1.9.0/install.sh | bash
Retrieve the install script from jsdelivr.net:
Using cURL and the install script:
export NVM_HOME=~/nvm; curl -o- https://cdn.jsdelivr.net/npm/@jchip/nvm@1.9.0/install.sh | bash
or wget:
export NVM_HOME=~/nvm; wget -qO- https://cdn.jsdelivr.net/npm/@jchip/nvm@1.9.0/install.sh | bash
The Universal NVM installation automatically updates your shell profile files to initialize nvm. The behavior differs between zsh and bash:
For zsh users, the installer updates both .zshenv and .zshrc:
.zshenv: Sourced for ALL shells (interactive and non-interactive).zshrc: Sourced for interactive shells onlyThis means:
nvx --install-to-user)For bash users, the installer updates .bashrc or .bash_profile:
.bash_profile: Sourced for login shells (macOS default).bashrc: Sourced for interactive non-login shells (Linux default)This means:
Using nvm in bash scripts:
If you need nvm in a bash script, you have three options:
Source the profile explicitly in your script:
#!/bin/bash
source ~/.bashrc
node --version
Use a login shell with the shebang:
#!/bin/bash -l
node --version
Set BASH_ENV to automatically source a file for non-interactive shells:
export BASH_ENV=~/.bashrc
You can add this to your .bash_profile to make it permanent, but be aware this will affect all bash scripts system-wide.
Note: This is standard bash behavior by design - non-interactive shells have a minimal environment for performance and predictability.
Usage: nvm <command> [options]
Commands:
nvm install <version> install the given version of Node.js
nvm uninstall <version> uninstall the given version of Node.js
nvm use <version> use the given version of Node.js in current shell
nvm auto-use [action] automatically use version from .nvmrc, .node-version,
or package.json
nvm auto-use enable [--cd] - enable automatic switching on cd
--cd: use cd wrapper mode (more efficient, only triggers on cd command)
nvm auto-use disable - disable automatic switching
nvm stop undo effects of nvm in current shell
[aliases: unuse]
nvm link <version> permanently link the version of Node.js as default
nvm unlink permanently unlink the default version
nvm ls list all the installed Node.js versions
nvm ls-remote list remote versions available for install
nvm cleanup remove stale local caches
nvm postinstall [version]
Invoke custom post install script for the given version
nvm init-env
(windows) Generate cmd file to initialize env for nvm
nvm undo-env (windows) Generate cmd file to undo env for nvm
Options:
--proxy, -p Set network proxy URL [string]
--verifyssl, --ssl, --no-ssl Turn on/off verify SSL certificate
[boolean] [default: true]
--corepack, --no-corepack Enable corepack after installation
[boolean]
--latest Match latest version to uninstall
--version, -V, -v Show version number
--help, -?, -h Show help. Add a command to show its help
[string]
Error: No command given
envs:
NVM_PROXY - set proxy URL
HTTP_PROXY - fallback proxy for HTTP requests
HTTPS_PROXY - fallback proxy for HTTPS requests
NVM_VERIFY_SSL - (true/false) turn on/off SSL certificate verification (default: true)
NVM_COREPACK_ENABLED - (true/false) enable corepack on install (default: false)
Proxy priority: -p flag > NVM_PROXY > HTTPS_PROXY > HTTP_PROXY
Examples:
nvm install lts
nvm install latest
nvm install 20 --corepack
nvm use 20
nvm uninstall 22.3
doc: https://www.npmjs.com/package/@jchip/nvm
Universal NVM can automatically switch Node.js versions when you change directories. When enabled, it will check for .nvmrc, .node-version, or package.json files and automatically switch to the specified version.
Quick Start:
# Enable automatic switching (modifies your shell profile)
nvm auto-use enable
# Enable with cd wrapper mode (more efficient, recommended)
nvm auto-use enable --cd
# Disable automatic switching
nvm auto-use disable
# Manually switch to version specified in current directory
nvm auto-use
Two modes available:
Auto-use offers two different modes for triggering version switches:
Prompt-based mode (default) - Runs on every prompt
cd wrapper mode (--cd flag) - Runs only on cd commands
pushd, popd, or terminal opening in new locationcdWhich mode to choose:
# Use prompt-based if you want comprehensive coverage
nvm auto-use enable
# Use cd wrapper if you prefer efficiency
nvm auto-use enable --cd
Note for Zsh users: Zsh always uses the optimal chpwd_functions mechanism (triggers only on actual directory change), so the --cd flag has no effect. Zsh users automatically get the best of both worlds!
What nvm auto-use enable does:
~/.bashrc, ~/.bash_profile, or ~/.zshrc$PROFILE)After enabling, restart your terminal or source your profile:
source ~/.bashrc # Bash on Linux
source ~/.bash_profile # Bash on macOS
source ~/.zshrc # Zsh
. $PROFILE # PowerShell
How it works:
.nvmrc, .node-version, or package.json)Using node v20.10.0 (auto-use from .nvmrc)Version 16.0.0 from .nvmrc not installed
cd commands won't repeat the same errorManual vs Automatic invocation:
cd/prompt hooks): Uses --silent flag to suppress "no version file found" errorsnvm auto-use): Shows all messages including "no version file found" errorsWhen auto-use is triggered automatically by changing directories, you'll see:
When you run nvm use or nvm auto-use without specifying a version, Universal NVM will automatically look for a version specification in the current directory.
Supported sources (in priority order):
.nvmrc - nvm-specific version file (checked first).node-version - Universal Node.js version file (checked if .nvmrc not found)package.json → engines.node - Fallback to package.json engines field (checked if no version files exist)Usage:
# Option 1: Create a .nvmrc file
echo "20.10.0" > .nvmrc
# Option 2: Create a .node-version file
echo "20.10.0" > .node-version
# Option 3: Use package.json engines.node
cat > package.json << EOF
{
"name": "my-project",
"engines": {
"node": ">=18.0.0"
}
}
EOF
# Use the version specified in any of these sources
nvm use
# Output varies based on source:
# - Read version 20.10.0 from .nvmrc
# - Read version 20.10.0 from .node-version
# - Read node requirement ">=18.0.0" from package.json
# Found installed version v20.10.0 matching ">=18.0.0"
File format:
.nvmrc and .node-version files should contain a plain text version number on a single line:
20.10.0
Or with the v prefix:
v20.10.0
Semver ranges:
All version sources support semantic versioning (semver) ranges. Universal NVM will automatically select the highest installed version that satisfies the requirement.
In .nvmrc or .node-version:
>=18.0.0
^20.0.0
20
In package.json engines.node:
The engines.node field supports the same semver syntax:
{
"engines": {
"node": ">=18.0.0" // Any version 18 or higher
}
}
{
"engines": {
"node": "^20.0.0" // Latest 20.x version
}
}
{
"engines": {
"node": ">=18.0.0 <21.0.0" // Version 18 or 20, but not 21+
}
}
If no installed version matches a semver range, you'll see a helpful error message suggesting which version to install.
Priority when multiple sources exist:
If multiple version sources exist in the same directory, Universal NVM will prefer them in this order:
# With all three present
$ cat .nvmrc
18.20.0
$ cat .node-version
20.10.0
$ cat package.json
{
"engines": { "node": ">=16.0.0" }
}
$ nvm use
# Output: Read version 18.20.0 from .nvmrc
# .node-version and package.json are ignored
Benefits of each approach:
.nvmrc - Best for teams using traditional nvm:
.node-version - Best for cross-tool compatibility:
package.json engines.node - Best for existing projects:
These env flags can be set:
| name | values | description |
|---|---|---|
NVM_PROXY | string | An URL to a network proxy (highest priority) |
https_proxy | string | An URL to a network proxy for HTTPS (lowercase, npm convention) |
HTTPS_PROXY | string | An URL to a network proxy for HTTPS (uppercase) |
http_proxy | string | An URL to a network proxy for HTTP (lowercase, npm convention) |
HTTP_PROXY | string | An URL to a network proxy for HTTP (uppercase) |
NVM_VERIFY_SSL | true/false | Controls SSL certificate verification (default: true) |
NVM_COREPACK_ENABLED | true/false | Enable corepack after installation (default: false) |
Proxy Priority:
-p flag (highest priority)NVM_PROXY (overrides all protocol-specific proxies)https_proxy → HTTPS_PROXY → http_proxy → HTTP_PROXYhttp_proxy → HTTP_PROXYFollowing npm convention, lowercase environment variables are checked first, then uppercase.
NVM_VERIFY_SSL)By default, Universal NVM verifies SSL/TLS certificates when downloading Node.js from distribution servers. This ensures you're downloading from a trusted source.
When to disable SSL verification:
You may need to set NVM_VERIFY_SSL=false in these scenarios:
How to use:
# Disable SSL verification via environment variable (Unix/macOS)
export NVM_VERIFY_SSL=false
nvm install lts
# Disable SSL verification via environment variable (Windows PowerShell)
$Env:NVM_VERIFY_SSL = "false"
nvm install lts
# Disable SSL verification via command-line flag
nvm install lts --no-ssl
Security Warning: Disabling SSL verification makes you vulnerable to man-in-the-middle attacks. Only disable it when you trust your network and understand the risks. Re-enable verification after completing your task:
# Re-enable SSL verification (Unix/macOS)
export NVM_VERIFY_SSL=true
# Re-enable SSL verification (Windows PowerShell)
$Env:NVM_VERIFY_SSL = "true"
NVM_COREPACK_ENABLED)Corepack is a built-in Node.js feature (available since v16.9.0) that manages package managers like Yarn and pnpm. It allows you to use the exact package manager version specified in your project's package.json without manually installing them.
When to enable corepack:
packageManager in package.jsonHow to use:
# Enable corepack via environment variable (Unix/macOS)
export NVM_COREPACK_ENABLED=true
nvm install lts
# Enable corepack via environment variable (Windows PowerShell)
$Env:NVM_COREPACK_ENABLED = "true"
nvm install lts
# Enable corepack via command-line flag (one-time)
nvm install 20 --corepack
# Disable corepack for a specific installation
nvm install 18 --no-corepack
What corepack does:
After installing Node.js, Universal NVM will automatically run corepack enable, which:
yarn and pnpm commands availablepackageManager field in your package.jsonExample package.json with packageManager:
{
"name": "my-project",
"packageManager": "pnpm@9.1.0",
"dependencies": {
"express": "^4.18.0"
}
}
With corepack enabled, running pnpm install will automatically use pnpm version 9.1.0, even if you don't have it installed globally.
Note: If corepack fails to enable (e.g., on Node.js versions before v16.9.0), Universal NVM will show a warning but will not fail the installation. You can manually enable it later with:
corepack enable
Priority: --corepack flag > NVM_COREPACK_ENABLED env var > default (false)
The nvx command allows you to run commands from your local node_modules/.bin directory without needing to specify the full path. It only runs locally installed packages, making it fast and predictable for running project-specific tools.
# Run eslint from local node_modules
nvx eslint src/
# Run prettier from local node_modules
nvx prettier --write .
# Run any locally installed CLI tool
nvx jest --watch
nvx --help
# or
nvx -h
On macOS and Linux, you can optionally add the Universal NVM bin directory to your system PATH to make nvm commands available in GUI applications (like VS Code).
This adds Universal NVM to your user's PATH. Works with GUI applications and doesn't require sudo:
macOS:
nvx --install-to-user
# Log out and log back in for changes to take effect
Linux:
nvx --install-to-user
# Log out and log back in for changes to take effect
This adds Universal NVM to the system-wide PATH for all users. Requires sudo:
macOS:
sudo nvx --install-to-system
# Restart your terminal for changes to take effect
Linux:
sudo nvx --install-to-system
# Log out and log back in for changes to take effect
Note for Windows users: On Windows, the installation script automatically adds both %NVM_HOME%\bin and %NVM_LINK% to your user PATH in the Windows registry. This makes Universal NVM, node, and npm immediately available to all applications (terminal, GUI apps like VS Code, etc.) without needing to run any additional commands. The nvx --install-to-user and nvx --install-to-system commands are therefore not needed on Windows.
The nvx --install-to-user command uses platform-specific mechanisms to make Universal NVM available to GUI applications:
macOS:
Creates a LaunchAgent at ~/Library/LaunchAgents/com.jchip.universal-nvm.plist that runs at login to set environment variables for the user session. This makes Universal NVM available to:
The LaunchAgent adds both paths to your environment:
~/nvm/bin - nvm commands (nvm, nvx)~/nvm/nodejs/bin - Node.js executables (node, npm) - only available after running nvm link <version>Linux:
Creates a systemd user environment file at ~/.config/environment.d/10-jchip-universal-nvm.conf. This file is read by systemd-based desktop environments at login and makes Universal NVM available to:
The environment file adds both paths:
~/nvm/bin - nvm commands (nvm, nvx)~/nvm/nodejs/bin - Node.js executables (node, npm) - only available after running nvm link <version>Important: The ~/nvm/nodejs/bin directory is a symlink created by nvm link <version> that points to the default Node.js version. You must run nvm link to set up a default Node.js version before GUI applications can access node and npm. The install script does this automatically.
Note: On Linux systems not using systemd, this feature may not work. In that case, you can manually add the paths to your ~/.profile or consult your distribution's documentation for setting user environment variables.
npm install -g fynfyn installfyn run testfyn run test:watchfyn run test:coverageTesting:
This project uses Vitest for testing. The test suite includes:
This project uses xrun for versioning and releasing. Do not use npm version or npm publish directly.
Update CHANGELOG.md - Add a new entry at the top with the version and date:
## X.Y.Z MMM DD, YYYY
- feat: description of new feature
- fix: description of bug fix
Bump version - Choose the appropriate version bump:
xrun version --patch # Bug fixes (1.7.0 -> 1.7.1)
xrun version --minor # New features (1.7.0 -> 1.8.0)
xrun version --major # Breaking changes (1.7.0 -> 2.0.0)
Release - Publish to npm:
xrun release
FAQs
nvm: a universal node.js version manager for Windows (no admin) and Unix
The npm package @jchip/nvm receives a total of 106 weekly downloads. As such, @jchip/nvm popularity was classified as not popular.
We found that @jchip/nvm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.