PowerShell module for managing multiple Node.js versions
PowerShell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.docs Add Format.ps1xml for SemVer versions May 7, 2018
.scripts Use PSCodeCovIo module Aug 13, 2018
.vscode
.editorconfig Support Semver (#39) Nov 20, 2017
.gitattributes Decided to try my hand at tests with pester for #27 (#28) Nov 8, 2017
.gitignore Support Semver (#39) Nov 20, 2017
.travis.yml Use PSCodeCovIo module Aug 13, 2018
License.md Readme and license Nov 5, 2014
README.md Trim down README to Getting Started and generate documentation refere… Dec 3, 2017
appveyor.yml
autocomplete-utils.ps1 adding autocomplete to the Remove and Set cmdlets (#52) Nov 26, 2017
nvm.Format.ps1xml Add Format.ps1xml for SemVer versions May 7, 2018
nvm.psd1 Cutting a new version Aug 13, 2018
nvm.psm1 Improve error handling for prompt use case Aug 13, 2018
nvm.tests.ps1 Fix test Aug 13, 2018

README.md

Node Version Manager for PowerShell

powershellgallery downloads codecov windows build macos/linux build

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