Skip to content

Latest commit

 

History

History
65 lines (44 loc) · 2.63 KB

README.md

File metadata and controls

65 lines (44 loc) · 2.63 KB

Node Version Manager for PowerShell

powershellgallery downloads codecov Docs Build Build Release

This is a simple PowerShell module for installing and using multiple Node.js versions in PowerShell. This is inspired by creationix's nvm tool for bash.

Works on Windows, macOS and Linux.

Getting Started

# Install from the PowerShell Gallery
Install-Module nvm

# Install Node v7
Install-NodeVersion 7

# Set active Node version in PATH to v7
Set-NodeVersion 7

# Set default Node version for the current user to v7 (Windows only)
Set-NodeVersion -Persist User 7

# Install the Node version specified in .nvmrc or package.json engine field
Install-NodeVersion

📖 Full Command Reference

Features

Semver ranges

ps-nvm works with semver ranges as used by npm. For example, you can pass ^6.0.0 or just 6 to Install-NodeVersion to install the latest 6.x.x version, or even >=6.0.0 <9.0.0 to install the latest version between v6 and v7. Versions returned are SemVer.Version objects that can be compared with comparison operators like -gt and -lt.

.nvmrc

If you don't specify a version for commands, ps-nvm will look for an .nvmrc plain text file in the current directory containing a node version to install.

package.json engines.node

If you don't specify a version and no .nvmrc is found, ps-nvm will read a package.json file in the current directory and use whatever version satisfies the engines.node field.

Contributing

# Install dependencies
cd .scripts
dotnet publish -o ..
cd ..

# Run tests
Install-Module Pester
Invoke-Pester

# Regenerate documentation
./.scripts/GenerateDocumentation.ps1