Run any arbitrary command in a subshell with the desired version of node
suggest changeList the Node versions nvm has installed:
nvm ls
v4.5.0
v6.7.0
nvm run <version> runs node with the arguments that follow. nvm exec <version> <command> runs some other command. These are two commands, not one line joined by or.
nvm run 4.5.0 --version
Running node v4.5.0 (npm v2.15.9)
v4.5.0
nvm exec 4.5.0 node --version
nvm run 6.7.0 --version
Running node v6.7.0 (npm v3.10.3)
v6.7.0
An alias works in the same position as a version:
nvm run default --version
Running node v6.7.0 (npm v3.10.3)
v6.7.0
Install the current LTS line:
nvm install --lts
Switch the shell to a version. stable is an old nvm name. Current installs use node for the latest release and --lts for the active LTS line.
nvm use v4.5.0
nvm use --lts
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents