Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[feature] Run command #76

Merged
merged 3 commits into from

2 participants

@mmalecki

run command runs given node version without modyfing global state:

[maciej@PC07 nvm (run)]$ node --version
v0.4.12
[maciej@PC07 nvm (run)]$ nvm run 0.4.12
Running node v0.4.12
> process.version
'v0.4.12'
> [maciej@PC07 nvm (run)]$ nvm run 0.5.9
Running node v0.5.9
> process.version
'v0.5.9'
> [maciej@PC07 nvm (run)]$ node --version
v0.4.12
mmalecki added some commits
@mmalecki mmalecki [feature] Add `run` command
`run` command runs given node version without modyfing global state:

    [maciej@PC07 nvm (run)]$ node --version
    v0.4.12
    [maciej@PC07 nvm (run)]$ nvm run 0.4.12
    Running node v0.4.12
    > process.version
    'v0.4.12'
    > [maciej@PC07 nvm (run)]$ nvm run 0.5.9
    Running node v0.5.9
    > process.version
    'v0.5.9'
    > [maciej@PC07 nvm (run)]$ node --version
    v0.4.12
09483f4
@mmalecki mmalecki [docs] Document `run` command 335a253
@mmalecki mmalecki [feature] Allow passing additional arguments to node
For example:

    nvm run v0.6.0 myApp.js
53e1764
@mmalecki

Updated so that you can nvm run v0.6.0 myApp.js (pass additional parameters).

@creationix creationix merged commit a987f8e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 29, 2011
  1. @mmalecki

    [feature] Add `run` command

    mmalecki authored
    `run` command runs given node version without modyfing global state:
    
        [maciej@PC07 nvm (run)]$ node --version
        v0.4.12
        [maciej@PC07 nvm (run)]$ nvm run 0.4.12
        Running node v0.4.12
        > process.version
        'v0.4.12'
        > [maciej@PC07 nvm (run)]$ nvm run 0.5.9
        Running node v0.5.9
        > process.version
        'v0.5.9'
        > [maciej@PC07 nvm (run)]$ node --version
        v0.4.12
  2. @mmalecki

    [docs] Document `run` command

    mmalecki authored
Commits on Nov 5, 2011
  1. @mmalecki

    [feature] Allow passing additional arguments to node

    mmalecki authored
    For example:
    
        nvm run v0.6.0 myApp.js
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 0 deletions.
  1. +4 −0 README.markdown
  2. +14 −0 nvm.sh
View
4 README.markdown
@@ -27,6 +27,10 @@ And then in any new shell just use the installed version:
nvm use v0.4.1
+Or you can just run it:
+
+ nvm run v0.4.1
+
If you want to see what versions are available:
nvm ls
View
14 nvm.sh
@@ -200,6 +200,20 @@ nvm()
export NVM_BIN="$NVM_DIR/$VERSION/bin"
echo "Now using node $VERSION"
;;
+ "run" )
+ # run given version of node
+ if [ $# -lt 2 ]; then
+ nvm help
+ return
+ fi
+ VERSION=`nvm_version $2`
+ if [ ! -d $NVM_DIR/$VERSION ]; then
+ echo "$VERSION version is not installed yet"
+ return;
+ fi
+ echo "Running node $VERSION"
+ $NVM_DIR/$VERSION/bin/node "${@:3}"
+ ;;
"ls" | "list" )
if [ $# -ne 1 ]; then
nvm_version $2
Something went wrong with that request. Please try again.