Compare commits

..

22 Commits

Author SHA1 Message Date
Jordan Harband
9f5322ee84 v0.31.2 2016-06-25 09:42:53 -07:00
Jordan Harband
b0244a133b [Fix] nvm ls: avoid use of maxdepth which is not on Solaris/SmartOS
Fixes #1121.
2016-06-24 01:38:27 -07:00
Jordan Harband
fdc08122e3 [Tests] swap order of slow + sourcing tests. 2016-05-08 23:52:51 -07:00
Jordan Harband
c9b7ccdaea Run node and io.js installation test suites separately. 2016-05-08 22:21:33 -07:00
Jordan Harband
d000624489 Merge pull request #1114 from brajpanda/patch-1
[Docs] Slightly elaborated the instruction for manual install
2016-06-19 22:26:58 -07:00
Jordan Harband
36b1ea9236 [Fix] do not print help text on sourcing when an empty .nvmrc file is found.
Fixes #1113.
2016-06-14 09:57:37 -07:00
Jordan Harband
45ae48df2d [Fix] nvm install -s: when “core id” doesn’t appear in /proc/cpuinfo, fall back to counting “processor” lines.
Fixes #1115.
2016-06-13 08:41:17 -07:00
Braj
d50272040d Slightly elaborated the instruction for manual install 2016-06-11 17:56:11 +05:30
ra100
b6481583af On aarch64 use arm64 packages 2016-06-10 08:00:51 +02:00
Jordan Harband
03cf6950ce [shellcheck] remove use of expr 2016-06-06 17:55:06 -07:00
Jordan Harband
20c551c608 Merge pull request #1106 from neilstuartcraig/patch-1
[Docs] Add info WRT installing on Alpine Linux / Busybox
2016-06-03 13:57:50 -07:00
chriskohlbrenner
9327e49ab5 [docs] replace "simple" with "simply", revise to consistent colon usage 2016-06-01 14:20:57 -04:00
Neil Craig
337ddbac16 Lowercase NVM
Lowercase NPM

Ref @mhart

Add information WRT installling on Alpine Linux
2016-06-01 13:35:41 +01:00
Jordan Harband
251a2f3409 [Fix] ensure uname is unaliased.
Closes #1105
2016-05-30 21:50:30 -07:00
Jordan Harband
b227f4dc77 [Docs] add some OS X notes to the README
Update README.markdown
2016-05-25 11:34:54 +02:00
Rudolph Sand
a2111c735e Update README.markdown
Added notes for OS X users regarding globally installed modules.
2016-05-25 11:31:38 +02:00
Stephan DONIN
f62747c29c [Fix] set -u: is variable set test 2016-05-22 15:59:04 +09:00
Dayton
74f9674a5d Update README.markdown with some stylistic changes 2016-05-17 16:49:18 -05:00
Jordan Harband
ccde2898f8 [help] Add nvm ls-remote <version>.
Fixes #1094.
2016-05-13 10:14:12 -05:00
Jordan Harband
6e18d959c7 [shellcheck] clean up unquoted args etc 2016-05-11 15:37:21 -07:00
Jordan Harband
6dd6a0d213 [Fix] dash does not support string substitution :-( 2016-05-10 01:17:31 -07:00
Jordan Harband
36c65d7115 [shellcheck] add spellcheck override comments 2016-05-10 01:11:17 -07:00
25 changed files with 175 additions and 123 deletions

View File

@@ -20,23 +20,33 @@ env:
- SHELL=bash TEST_SUITE=fast - SHELL=bash TEST_SUITE=fast
- SHELL=zsh TEST_SUITE=fast - SHELL=zsh TEST_SUITE=fast
# - SHELL=ksh TEST_SUITE=fast # - SHELL=ksh TEST_SUITE=fast
- SHELL=sh TEST_SUITE=slow
- SHELL=dash TEST_SUITE=slow
- SHELL=bash TEST_SUITE=slow
- SHELL=zsh TEST_SUITE=slow
# - SHELL=ksh TEST_SUITE=slow
- SHELL=sh TEST_SUITE=sourcing - SHELL=sh TEST_SUITE=sourcing
- SHELL=dash TEST_SUITE=sourcing - SHELL=dash TEST_SUITE=sourcing
- SHELL=bash TEST_SUITE=sourcing - SHELL=bash TEST_SUITE=sourcing
- SHELL=zsh TEST_SUITE=sourcing - SHELL=zsh TEST_SUITE=sourcing
# - SHELL=ksh TEST_SUITE=sourcing # - SHELL=ksh TEST_SUITE=sourcing
- SHELL=sh TEST_SUITE=installation - SHELL=sh TEST_SUITE=slow
# - SHELL=sh TEST_SUITE=installation WITHOUT_CURL=1 - SHELL=dash TEST_SUITE=slow
- SHELL=dash TEST_SUITE=installation - SHELL=bash TEST_SUITE=slow
# - SHELL=dash TEST_SUITE=installation WITHOUT_CURL=1 - SHELL=zsh TEST_SUITE=slow
- SHELL=bash TEST_SUITE=installation # - SHELL=ksh TEST_SUITE=slow
# - SHELL=bash TEST_SUITE=installation WITHOUT_CURL=1 - SHELL=sh TEST_SUITE=installation_node
- SHELL=zsh TEST_SUITE=installation # - SHELL=sh TEST_SUITE=installation_node WITHOUT_CURL=1
# - SHELL=zsh TEST_SUITE=installation WITHOUT_CURL=1 - SHELL=dash TEST_SUITE=installation_node
# - SHELL=ksh TEST_SUITE=installation # - SHELL=dash TEST_SUITE=installation_node WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation WITHOUT_CURL=1 - SHELL=bash TEST_SUITE=installation_node
# - SHELL=bash TEST_SUITE=installation_node WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_node
# - SHELL=zsh TEST_SUITE=installation_node WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_node
# - SHELL=ksh TEST_SUITE=installation_node WITHOUT_CURL=1
- SHELL=sh TEST_SUITE=installation_iojs
# - SHELL=sh TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=dash TEST_SUITE=installation_iojs
# - SHELL=dash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=bash TEST_SUITE=installation_iojs
# - SHELL=bash TEST_SUITE=installation_iojs WITHOUT_CURL=1
- SHELL=zsh TEST_SUITE=installation_iojs
# - SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=1
# - SHELL=ksh TEST_SUITE=installation_iojs
# - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1

View File

@@ -2,7 +2,7 @@
## Installation ## Installation
First you'll need to make sure your system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential and libssl-dev packages work. First you'll need to make sure your system has a c++ compiler. For OS X, Xcode will work, for Ubuntu, the build-essential and libssl-dev packages work.
Note: `nvm` does not support Windows (see [#284](https://github.com/creationix/nvm/issues/284)). Two alternatives exist, which are neither supported nor developed by us: Note: `nvm` does not support Windows (see [#284](https://github.com/creationix/nvm/issues/284)). Two alternatives exist, which are neither supported nor developed by us:
- [nvm-windows](https://github.com/coreybutler/nvm-windows) - [nvm-windows](https://github.com/coreybutler/nvm-windows)
@@ -20,20 +20,25 @@ Note: We still have some problems with FreeBSD, because there is no pre-built bi
- [[#900] [Bug] nodejs on FreeBSD need to be patched ](https://github.com/creationix/nvm/issues/900) - [[#900] [Bug] nodejs on FreeBSD need to be patched ](https://github.com/creationix/nvm/issues/900)
- [nodejs/node#3716](https://github.com/nodejs/node/issues/3716) - [nodejs/node#3716](https://github.com/nodejs/node/issues/3716)
Note: On OSX, if you do not have XCode installed and you do not wish to download the ~4.3GB file, you can install the `Command Line Tools`. You can check out this blog post on how to just that: Note: On OS X, if you do not have Xcode installed and you do not wish to download the ~4.3GB file, you can install the `Command Line Tools`. You can check out this blog post on how to just that:
- [How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode)](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/) - [How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode)](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/)
Note: On OS X, if you have/had a "system" node installed and want to install modules globally, keep in mind that:
- When using nvm you do not need `sudo` to globally install a module with `npm -g`, so instead of doing `sudo npm install -g grunt`, do instead `npm install -g grunt`
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with nvm)
- You can (but should not?) keep your previous "system" node install, but nvm will only be available to your user account (the one used to install nvm). This might cause version mismatches, as other users will be using `/usr/local/lib/node_modules/*` VS your user account using `~/.nvm/versions/node/vX.X.X/lib/node_modules/*`
Homebrew installation is not supported. Homebrew installation is not supported.
### Install script ### Install script
To install or update nvm, you can use the [install script][2] using cURL: To install or update nvm, you can use the [install script][2] using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
or Wget: or Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub> <sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub>
@@ -42,11 +47,11 @@ Eg: `curl ... | NVM_DIR="path/to/nvm" bash`
<sub>*NB. The installer can use `git`, `curl`, or `wget` to download `nvm`, whatever is available.*</sub> <sub>*NB. The installer can use `git`, `curl`, or `wget` to download `nvm`, whatever is available.*</sub>
Note: On OSX, if you get `nvm: command not found` after running the install script, your system may not have a [.bash_profile file] where the command is set up. Simple create one with `touch ~/.bash_profile` and run the install script again. Note: On OS X, if you get `nvm: command not found` after running the install script, your system may not have a [.bash_profile file] where the command is set up. Simply create one with `touch ~/.bash_profile` and run the install script again.
### Verify installation ### Verify installation
To verify that nvm has been installed, do To verify that nvm has been installed, do:
command -v nvm command -v nvm
@@ -65,6 +70,7 @@ To activate nvm, you need to source it from your shell:
. ~/.nvm/nvm.sh . ~/.nvm/nvm.sh
Add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login: Add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it automatically sourced upon login:
(you may have to add to more than one of the above files)
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
@@ -142,7 +148,7 @@ If you want to see what versions are available to install:
nvm ls-remote nvm ls-remote
To restore your PATH, you can deactivate it. To restore your PATH, you can deactivate it:
nvm deactivate nvm deactivate
@@ -230,15 +236,15 @@ Tests are written in [Urchin]. Install Urchin (and other dependencies) like so:
There are slow tests and fast tests. The slow tests do things like install node There are slow tests and fast tests. The slow tests do things like install node
and check that the right versions are used. The fast tests fake this to test and check that the right versions are used. The fast tests fake this to test
things like aliases and uninstalling. From the root of the nvm git repository, things like aliases and uninstalling. From the root of the nvm git repository,
run the fast tests like this. run the fast tests like this:
npm run test/fast npm run test/fast
Run the slow tests like this. Run the slow tests like this:
npm run test/slow npm run test/slow
Run all of the tests like this Run all of the tests like this:
npm test npm test
@@ -250,18 +256,18 @@ To activate, you need to source `bash_completion`:
[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion [[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
Put the above sourcing line just below the sourcing line for NVM in your profile (`.bashrc`, `.bash_profile`). Put the above sourcing line just below the sourcing line for nvm in your profile (`.bashrc`, `.bash_profile`).
### Usage ### Usage
nvm nvm:
$ nvm [tab][tab] $ nvm [tab][tab]
alias deactivate install ls run unload alias deactivate install ls run unload
clear-cache exec list ls-remote unalias use clear-cache exec list ls-remote unalias use
current help list-remote reinstall-packages uninstall version current help list-remote reinstall-packages uninstall version
nvm alias nvm alias:
$ nvm alias [tab][tab] $ nvm alias [tab][tab]
default default
@@ -269,12 +275,12 @@ nvm alias
$ nvm alias my_alias [tab][tab] $ nvm alias my_alias [tab][tab]
v0.6.21 v0.8.26 v0.10.28 v0.6.21 v0.8.26 v0.10.28
nvm use nvm use:
$ nvm use [tab][tab] $ nvm use [tab][tab]
my_alias default v0.6.21 v0.8.26 v0.10.28 my_alias default v0.6.21 v0.8.26 v0.10.28
nvm uninstall nvm uninstall:
$ nvm uninstall [tab][tab] $ nvm uninstall [tab][tab]
my_alias default v0.6.21 v0.8.26 v0.10.28 my_alias default v0.6.21 v0.8.26 v0.10.28
@@ -283,7 +289,7 @@ nvm uninstall
`nvm` will encounter some issues if you have some non-default settings set. (see [#606](/../../issues/606)) `nvm` will encounter some issues if you have some non-default settings set. (see [#606](/../../issues/606))
The following are known to cause issues: The following are known to cause issues:
Inside `~/.npmrc` Inside `~/.npmrc`:
``` ```
prefix='some/path' prefix='some/path'
``` ```
@@ -297,6 +303,25 @@ Shell settings:
set -e set -e
``` ```
## Installing nvm on Alpine Linux
In order to provide the best performance (and other optimisations), nvm will download and install pre-compiled binaries for Node (and npm) when you run `nvm install X`. The Node project compiles, tests and hosts/provides pre-these compiled binaries which are built for mainstream/traditional Linux distributions (such as Debian, Ubuntu, CentOS, RedHat et al).
Alpine Linux, unlike mainstream/traditional Linux distributions, is based on [busybox](https://www.busybox.net/), a very compact (~5MB) Linux distribution. Busybox (and thus Alpine Linux) uses a different C/C++ stack to most mainstream/traditional Linux distributions - [musl](https://www.musl-libc.org/). This makes binary programs built for such mainstream/traditional incompatible with Alpine Linux, thus we cannot simply `nvm install X` on Alpine Linux and expect the downloaded binary to run correctly - you'll likely see "...does not exist" errors if you try that.
There is a `-s` flag for `nvm install` which requests nvm download Node source and compile it locally but currently (May 2016), this is not available for Node versions newer than v0.10 so unless you need an older Node version, this won't help you. Work is in progress on source-builds for newer Node versions but is not yet complete.
If installing nvm on Alpine Linux *is* still what you want or need to do, you should be able to achieve this by running the following from you Alpine Linux shell:
```
apk add bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | /bin/bash
```
The Node project has some desire but no concrete plans (due to the overheads of building, testing and support) to offer Alpine-compatible binaries.
As a potential alternative, @mhart (a Node contributor) has some [Docker images for Alpine Linux with Node and optionally, npm, pre-installed](https://github.com/mhart/alpine-node).
## Problems ## Problems
If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following: If you try to install a node version and the installation fails, be sure to delete the node downloads from src (~/.nvm/src/) or you might get an error when trying to reinstall them again or you might get an error like the following:
@@ -307,7 +332,7 @@ Where's my 'sudo node'? Check out this link:
https://github.com/creationix/nvm/issues/43 https://github.com/creationix/nvm/issues/43
On Arch Linux and other systems using python3 by default, before running *install* you need to On Arch Linux and other systems using python3 by default, before running *install* you need to:
export PYTHON=python2 export PYTHON=python2
@@ -318,7 +343,7 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658)) If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658))
[1]: https://github.com/creationix/nvm.git [1]: https://github.com/creationix/nvm.git
[2]: https://github.com/creationix/nvm/blob/v0.31.1/install.sh [2]: https://github.com/creationix/nvm/blob/v0.31.2/install.sh
[3]: https://travis-ci.org/creationix/nvm [3]: https://travis-ci.org/creationix/nvm
[Urchin]: https://github.com/scraperwiki/urchin [Urchin]: https://github.com/scraperwiki/urchin
[Fish]: http://fishshell.com [Fish]: http://fishshell.com

View File

@@ -11,7 +11,7 @@ if [ -z "$NVM_DIR" ]; then
fi fi
nvm_latest_version() { nvm_latest_version() {
echo "v0.31.1" echo "v0.31.2"
} }
# #

79
nvm.sh
View File

@@ -6,6 +6,8 @@
# Implemented by Tim Caswell <tim@creationix.com> # Implemented by Tim Caswell <tim@creationix.com>
# with much bash help from Matthew Ranney # with much bash help from Matthew Ranney
# "local" warning, quote expansion warning
# shellcheck disable=SC2039,SC2016
{ # this ensures the entire script is downloaded # { # this ensures the entire script is downloaded #
NVM_SCRIPT_SOURCE="$_" NVM_SCRIPT_SOURCE="$_"
@@ -15,12 +17,12 @@ nvm_echo() {
nvm_echo() { nvm_echo() {
\printf %s\\n "$*" # on zsh, `command printf` sometimes fails \printf %s\\n "$*" # on zsh, `command printf` sometimes fails
} }
nvm_echo "$*" nvm_echo "$@"
} }
} }
nvm_err() { nvm_err() {
>&2 nvm_echo "$*" >&2 nvm_echo "$@"
} }
nvm_has() { nvm_has() {
@@ -57,10 +59,10 @@ nvm_get_latest() {
nvm_download() { nvm_download() {
if nvm_has "curl"; then if nvm_has "curl"; then
curl -q $* curl -q "$@"
elif nvm_has "wget"; then elif nvm_has "wget"; then
# Emulate curl with wget # Emulate curl with wget
ARGS=$(nvm_echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \ ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \ -e 's/-L //' \
-e 's/-I /--server-response /' \ -e 's/-I /--server-response /' \
-e 's/-s /-q /' \ -e 's/-s /-q /' \
@@ -100,6 +102,7 @@ fi
# Auto detect the NVM_DIR when not set # Auto detect the NVM_DIR when not set
if [ -z "${NVM_DIR-}" ]; then if [ -z "${NVM_DIR-}" ]; then
# shellcheck disable=SC2128
if [ -n "$BASH_SOURCE" ]; then if [ -n "$BASH_SOURCE" ]; then
NVM_SCRIPT_SOURCE="${BASH_SOURCE[0]}" NVM_SCRIPT_SOURCE="${BASH_SOURCE[0]}"
fi fi
@@ -163,7 +166,12 @@ nvm_rc_version() {
NVMRC_PATH="$(nvm_find_nvmrc)" NVMRC_PATH="$(nvm_find_nvmrc)"
if [ -e "$NVMRC_PATH" ]; then if [ -e "$NVMRC_PATH" ]; then
read -r NVM_RC_VERSION < "$NVMRC_PATH" || printf '' read -r NVM_RC_VERSION < "$NVMRC_PATH" || printf ''
nvm_echo "Found '$NVMRC_PATH' with version <$NVM_RC_VERSION>" if [ -n "$NVM_RC_VERSION" ]; then
nvm_echo "Found '$NVMRC_PATH' with version <$NVM_RC_VERSION>"
else
nvm_err "Warning: empty .nvmrc file found at \"$NVMRC_PATH\""
return 2
fi
else else
nvm_err "No .nvmrc file found" nvm_err "No .nvmrc file found"
return 1 return 1
@@ -767,34 +775,40 @@ nvm_ls() {
fi fi
fi fi
if ! [ -d "$NVM_DIRS_TO_SEARCH1" ]; then if ! [ -d "$NVM_DIRS_TO_SEARCH1" ] || ! (command ls -1qA "$NVM_DIRS_TO_SEARCH1" | command grep -q .); then
NVM_DIRS_TO_SEARCH1='' NVM_DIRS_TO_SEARCH1=''
fi fi
if ! [ -d "$NVM_DIRS_TO_SEARCH2" ]; then if ! [ -d "$NVM_DIRS_TO_SEARCH2" ] || ! (command ls -1qA "$NVM_DIRS_TO_SEARCH2" | command grep -q .); then
NVM_DIRS_TO_SEARCH2="$NVM_DIRS_TO_SEARCH1" NVM_DIRS_TO_SEARCH2="$NVM_DIRS_TO_SEARCH1"
fi fi
if ! [ -d "$NVM_DIRS_TO_SEARCH3" ]; then if ! [ -d "$NVM_DIRS_TO_SEARCH3" ] || ! (command ls -1qA "$NVM_DIRS_TO_SEARCH3" | command grep -q .); then
NVM_DIRS_TO_SEARCH3="$NVM_DIRS_TO_SEARCH2" NVM_DIRS_TO_SEARCH3="$NVM_DIRS_TO_SEARCH2"
fi fi
local SEARCH_PATTERN
if [ -z "$PATTERN" ]; then if [ -z "$PATTERN" ]; then
PATTERN='v' PATTERN='v'
SEARCH_PATTERN='.*'
else
SEARCH_PATTERN="$(echo "${PATTERN}" | sed "s#\.#\\\.#g;")"
fi fi
if [ -n "$NVM_DIRS_TO_SEARCH1$NVM_DIRS_TO_SEARCH2$NVM_DIRS_TO_SEARCH3" ]; then if [ -n "$NVM_DIRS_TO_SEARCH1$NVM_DIRS_TO_SEARCH2$NVM_DIRS_TO_SEARCH3" ]; then
VERSIONS="$(command find "$NVM_DIRS_TO_SEARCH1" "$NVM_DIRS_TO_SEARCH2" "$NVM_DIRS_TO_SEARCH3" -maxdepth 1 -type d -name "$PATTERN*" \ VERSIONS="$(command find "$NVM_DIRS_TO_SEARCH1"/* "$NVM_DIRS_TO_SEARCH2"/* "$NVM_DIRS_TO_SEARCH3"/* -name . -o -type d -prune -o -name "$PATTERN*" \
| command sed " | command sed "
s#$NVM_VERSION_DIR_IOJS/#$NVM_IOJS_PREFIX-#; s#${NVM_VERSION_DIR_IOJS}/#versions/${NVM_IOJS_PREFIX}/#;
\#$NVM_VERSION_DIR_IOJS# d; s#^${NVM_DIR}/##;
s#^$NVM_DIR/##; \#^[^v]# d;
\#^versions\$# d; \#^versions\$# d;
s#^versions/##; s#^versions/##;
s#^v#$NVM_NODE_PREFIX-v#; s#^v#${NVM_NODE_PREFIX}/v#;
s#^\($NVM_IOJS_PREFIX\)[-/]v#\1.v#; \#${SEARCH_PATTERN}# !d;
s#^\($NVM_NODE_PREFIX\)[-/]v#\1.v#" \ " \
| command sort -t. -u -k 2.2,2n -k 3,3n -k 4,4n \ | command sed -E "s#^([^/]+)/(.*)\$#\2.\1#;" \
| command sed " | command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n \
s/^\($NVM_IOJS_PREFIX\)\./\1-/; | command sed -E "
s/^$NVM_NODE_PREFIX\.//" \ s#(.*)\.([^\.]+)\$#\2-\1#;
s#^${NVM_NODE_PREFIX}-##;
" \
)" )"
fi fi
@@ -1086,7 +1100,7 @@ nvm_print_implicit_alias() {
if [ "_0${NORMALIZED_VERSION#?}" != "_$NORMALIZED_VERSION" ]; then if [ "_0${NORMALIZED_VERSION#?}" != "_$NORMALIZED_VERSION" ]; then
STABLE="$MINOR" STABLE="$MINOR"
else else
MOD=$(expr "$NORMALIZED_VERSION" \/ 1000000 \% 2) MOD="$(awk 'BEGIN { print int(ARGV[1] / 1000000) % 2 ; exit(0) }' "$NORMALIZED_VERSION")"
if [ "$MOD" -eq 0 ]; then if [ "$MOD" -eq 0 ]; then
STABLE="$MINOR" STABLE="$MINOR"
elif [ "$MOD" -eq 1 ]; then elif [ "$MOD" -eq 1 ]; then
@@ -1107,7 +1121,7 @@ nvm_print_implicit_alias() {
nvm_get_os() { nvm_get_os() {
local NVM_UNAME local NVM_UNAME
NVM_UNAME="$(uname -a)" NVM_UNAME="$(command uname -a)"
local NVM_OS local NVM_OS
case "$NVM_UNAME" in case "$NVM_UNAME" in
Linux\ *) NVM_OS=linux ;; Linux\ *) NVM_OS=linux ;;
@@ -1135,13 +1149,14 @@ nvm_get_arch() {
HOST_ARCH=$(isainfo -n) HOST_ARCH=$(isainfo -n)
fi fi
else else
HOST_ARCH="$(uname -m)" HOST_ARCH="$(command uname -m)"
fi fi
local NVM_ARCH local NVM_ARCH
case "$HOST_ARCH" in case "$HOST_ARCH" in
x86_64 | amd64) NVM_ARCH="x64" ;; x86_64 | amd64) NVM_ARCH="x64" ;;
i*86) NVM_ARCH="x86" ;; i*86) NVM_ARCH="x86" ;;
aarch64) NVM_ARCH="arm64" ;;
*) NVM_ARCH="$HOST_ARCH" ;; *) NVM_ARCH="$HOST_ARCH" ;;
esac esac
nvm_echo "${NVM_ARCH}" nvm_echo "${NVM_ARCH}"
@@ -1419,7 +1434,7 @@ nvm_get_make_jobs() {
NVM_OS="$(nvm_get_os)" NVM_OS="$(nvm_get_os)"
local NVM_CPU_THREADS local NVM_CPU_THREADS
if [ "_$NVM_OS" = "_linux" ]; then if [ "_$NVM_OS" = "_linux" ]; then
NVM_CPU_THREADS="$(grep -c 'core id' /proc/cpuinfo)" NVM_CPU_THREADS="$(command grep -c -E '^processor.+: [0-9]+' /proc/cpuinfo)"
elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)" NVM_CPU_THREADS="$(sysctl -n hw.ncpu)"
elif [ "_$NVM_OS" = "_sunos" ]; then elif [ "_$NVM_OS" = "_sunos" ]; then
@@ -1432,7 +1447,7 @@ nvm_get_make_jobs() {
else else
nvm_echo "Detected that you have $NVM_CPU_THREADS CPU thread(s)" nvm_echo "Detected that you have $NVM_CPU_THREADS CPU thread(s)"
if [ "$NVM_CPU_THREADS" -gt 2 ]; then if [ "$NVM_CPU_THREADS" -gt 2 ]; then
NVM_MAKE_JOBS=$(($NVM_CPU_THREADS - 1)) NVM_MAKE_JOBS=$((NVM_CPU_THREADS - 1))
nvm_echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build" nvm_echo "Set the number of jobs to $NVM_CPU_THREADS - 1 = $NVM_MAKE_JOBS jobs to speed up the build"
else else
NVM_MAKE_JOBS=1 NVM_MAKE_JOBS=1
@@ -1669,10 +1684,10 @@ nvm_sanitize_path() {
local SANITIZED_PATH local SANITIZED_PATH
SANITIZED_PATH="${1-}" SANITIZED_PATH="${1-}"
if [ "_$SANITIZED_PATH" != "_$NVM_DIR" ]; then if [ "_$SANITIZED_PATH" != "_$NVM_DIR" ]; then
SANITIZED_PATH="${SANITIZED_PATH/#$NVM_DIR/\$NVM_DIR}" SANITIZED_PATH="$(nvm_echo "$SANITIZED_PATH" | command sed -e "s#$NVM_DIR#\$NVM_DIR#g")"
fi fi
if [ "_$SANITIZED_PATH" != "_$HOME" ]; then if [ "_$SANITIZED_PATH" != "_$HOME" ]; then
SANITIZED_PATH="${SANITIZED_PATH/#$HOME/\$HOME}" SANITIZED_PATH="$(nvm_echo "$SANITIZED_PATH" | command sed -e "s#$HOME#\$HOME#g")"
fi fi
nvm_echo "$SANITIZED_PATH" nvm_echo "$SANITIZED_PATH"
} }
@@ -1745,6 +1760,7 @@ nvm() {
nvm_echo ' nvm ls List installed versions' nvm_echo ' nvm ls List installed versions'
nvm_echo ' nvm ls <version> List versions matching a given description' nvm_echo ' nvm ls <version> List versions matching a given description'
nvm_echo ' nvm ls-remote List remote versions available for install' nvm_echo ' nvm ls-remote List remote versions available for install'
nvm_echo ' nvm ls-remote <version> List remote versions available for install, matching a given <version>'
nvm_echo ' nvm version <version> Resolve the given description to a single local version' nvm_echo ' nvm version <version> Resolve the given description to a single local version'
nvm_echo ' nvm version-remote <version> Resolve the given description to a single remote version' nvm_echo ' nvm version-remote <version> Resolve the given description to a single remote version'
nvm_echo ' nvm deactivate Undo effects of `nvm` on current shell' nvm_echo ' nvm deactivate Undo effects of `nvm` on current shell'
@@ -2162,7 +2178,7 @@ nvm() {
return 11 return 11
fi fi
fi fi
if [ -n "$NVM_USE_OUTPUT" ]; then if [ -n "${NVM_USE_OUTPUT-}" ]; then
nvm_echo "$NVM_USE_OUTPUT" nvm_echo "$NVM_USE_OUTPUT"
fi fi
;; ;;
@@ -2228,8 +2244,6 @@ nvm() {
NVM_IOJS=true NVM_IOJS=true
fi fi
local ARGS
ARGS="$@"
local EXIT_CODE local EXIT_CODE
local ZHS_HAS_SHWORDSPLIT_UNSET local ZHS_HAS_SHWORDSPLIT_UNSET
@@ -2241,9 +2255,9 @@ nvm() {
if [ "_$VERSION" = "_N/A" ]; then if [ "_$VERSION" = "_N/A" ]; then
nvm_ensure_version_installed "$provided_version" nvm_ensure_version_installed "$provided_version"
elif [ "$NVM_IOJS" = true ]; then elif [ "$NVM_IOJS" = true ]; then
nvm exec "${NVM_SILENT-}" "$VERSION" iojs $ARGS nvm exec "${NVM_SILENT-}" "$VERSION" iojs "$@"
else else
nvm exec "${NVM_SILENT-}" "$VERSION" node $ARGS nvm exec "${NVM_SILENT-}" "$VERSION" node "$@"
fi fi
EXIT_CODE="$?" EXIT_CODE="$?"
if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then if [ "$ZHS_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
@@ -2528,7 +2542,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
nvm_remote_version "$2" nvm_remote_version "$2"
;; ;;
"--version" ) "--version" )
nvm_echo '0.31.1' nvm_echo '0.31.2'
;; ;;
"unload" ) "unload" )
unset -f nvm nvm_print_versions nvm_checksum \ unset -f nvm nvm_print_versions nvm_checksum \
@@ -2565,6 +2579,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | command grep -v "N/A" | command sed '/^$/d'
} }
nvm_supports_source_options() { nvm_supports_source_options() {
# shellcheck disable=SC1091
[ "_$(echo '[ $# -gt 0 ] && echo $1' | . /dev/stdin yes 2> /dev/null)" = "_yes" ] [ "_$(echo '[ $# -gt 0 ] && echo $1' | . /dev/stdin yes 2> /dev/null)" = "_yes" ]
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "nvm", "name": "nvm",
"version": "0.31.1", "version": "0.31.2",
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions", "description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
"directories": { "directories": {
"test": "test" "test": "test"
@@ -10,7 +10,9 @@
"test/fast": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=fast test-$shell", "test/fast": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=fast test-$shell",
"test/slow": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=slow test-$shell", "test/slow": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=slow test-$shell",
"test/install_script": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=install_script test-$shell", "test/install_script": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=install_script test-$shell",
"test/installation": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation test-$shell", "test/installation": "npm run --silent test/installation/node && npm run --silent test/installation/iojs",
"test/installation/node": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_node test-$shell",
"test/installation/iojs": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=installation_iojs test-$shell",
"test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell" "test/sourcing": "shell=$(basename -- $(ps -o comm= $(ps -o ppid= -p $PPID)) | sed 's/^-//'); make TEST_SUITE=sourcing test-$shell"
}, },
"repository": { "repository": {

View File

@@ -2,7 +2,7 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message" [ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"

View File

@@ -2,7 +2,7 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION="v1.0.0" NVM_TEST_VERSION="v1.0.0"
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION" NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"

View File

@@ -2,19 +2,19 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0 [ -e ../../versions/io.js/v1.0.0 ] && rm -R ../../versions/io.js/v1.0.0
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1 [ -e ../../versions/io.js/v1.0.1 ] && rm -R ../../versions/io.js/v1.0.1
# Install from binary # Install from binary
nvm install iojs-v1.0.0 || die "'nvm install iojs-v1.0.0' failed" nvm install iojs-v1.0.0 || die "'nvm install iojs-v1.0.0' failed"
nvm i iojs-v1.0.1 || die "'nvm i iojs-v1.0.1' failed" nvm i iojs-v1.0.1 || die "'nvm i iojs-v1.0.1' failed"
# Check # Check
[ -d ../../../versions/io.js/v1.0.0 ] || die "iojs v1.0.0 didn't exist" [ -d ../../versions/io.js/v1.0.0 ] || die "iojs v1.0.0 didn't exist"
[ -d ../../../versions/io.js/v1.0.1 ] || die "iojs v1.0.1 didn't exist" [ -d ../../versions/io.js/v1.0.1 ] || die "iojs v1.0.1 didn't exist"
# Use the first one # Use the first one
nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed" nvm use iojs-1.0.0 || die "'nvm use iojs-1.0.0' failed"

View File

@@ -2,11 +2,11 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v1.0.0 NVM_TEST_VERSION=v1.0.0
NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION" NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
VERSION_PATH="../../../versions/io.js/$NVM_TEST_VERSION" VERSION_PATH="../../versions/io.js/$NVM_TEST_VERSION"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e $VERSION_PATH ] && rm -R $VERSION_PATH [ -e $VERSION_PATH ] && rm -R $VERSION_PATH

View File

@@ -2,17 +2,17 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../versions/io.js/v1.0.0 ] && rm -R ../../../versions/io.js/v1.0.0 [ -e ../../versions/io.js/v1.0.0 ] && rm -R ../../versions/io.js/v1.0.0
[ -e ../../../versions/io.js/v1.0.1 ] && rm -R ../../../versions/io.js/v1.0.1 [ -e ../../versions/io.js/v1.0.1 ] && rm -R ../../versions/io.js/v1.0.1
# Install from binary # Install from binary
nvm install iojs-v1.0.0 nvm install iojs-v1.0.0
# Check # Check
[ -d ../../../versions/io.js/v1.0.0 ] || die "nvm install iojs-v1.0.0 didn't install" [ -d ../../versions/io.js/v1.0.0 ] || die "nvm install iojs-v1.0.0 didn't install"
node --version | grep v1.0.0 > /dev/null || die "nvm install didn't use iojs-v1.0.0" node --version | grep v1.0.0 > /dev/null || die "nvm install didn't use iojs-v1.0.0"
@@ -23,7 +23,7 @@ nvm ls iojs-1 | grep iojs-v1.0.0 > /dev/null || die "nvm ls iojs-1 didn't show i
nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 || die "nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 failed" nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 || die "nvm install iojs-v1.0.1 --reinstall-packages-from=iojs-1.0.0 failed"
[ -d ../../../versions/io.js/v1.0.1 ] || die "nvm install iojs-v1.0.1 didn't install" [ -d ../../versions/io.js/v1.0.1 ] || die "nvm install iojs-v1.0.1 didn't install"
nvm use iojs-1 nvm use iojs-1
node --version | grep v1.0.1 > /dev/null || die "nvm use iojs-1 didn't use v1.0.1" node --version | grep v1.0.1 > /dev/null || die "nvm use iojs-1 didn't use v1.0.1"

View File

@@ -2,19 +2,19 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_VERSION="v1" NVM_VERSION="v1"
NVM_PREFIXED_TEST_VERSION="$(nvm ls-remote "$NVM_VERSION" | tail -n1 | sed 's/^[ ]*//;s/[ ]*$//')" NVM_PREFIXED_TEST_VERSION="$(nvm ls-remote "$NVM_VERSION" | tail -n1 | sed 's/^[ ]*//;s/[ ]*$//')"
NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")" NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from binary # Install from binary
nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed" nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed"
# Check # Check
[ -d ../../../versions/io.js/$NVM_TEST_VERSION ] [ -d ../../versions/io.js/$NVM_TEST_VERSION ]
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. ../../../nvm.sh . ../../nvm.sh
nvm deactivate nvm deactivate
nvm uninstall iojs-v1.0.0 nvm uninstall iojs-v1.0.0

View File

@@ -2,13 +2,13 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
[ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message" [ "$(nvm install invalid.invalid 2>&1)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../v0.9.7 ] && rm -R ../../../v0.9.7 [ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12 [ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
# Install from binary # Install from binary
nvm install 0.9.7 nvm install 0.9.7

View File

@@ -2,20 +2,20 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
nvm unalias default || die 'unable to unalias default' nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from binary # Install from binary
nvm install $NVM_TEST_VERSION || die "install $NVM_TEST_VERSION failed" nvm install $NVM_TEST_VERSION || die "install $NVM_TEST_VERSION failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] [ -d ../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
# ensure default is set # ensure default is set

View File

@@ -2,20 +2,20 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
nvm unalias default || die 'unable to unalias default' nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from source # Install from source
nvm install -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed" nvm install -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] [ -d ../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
# ensure default is set # ensure default is set

View File

@@ -2,17 +2,17 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v0.8.5 NVM_TEST_VERSION=v0.8.5
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from source implicitly (v0.8.6 is when binaries started) # Install from source implicitly (v0.8.6 is when binaries started)
nvm install $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed" nvm install $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] [ -d ../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@@ -2,20 +2,20 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v0.10.41 NVM_TEST_VERSION=v0.10.41
# STAGE 1 # # STAGE 1 #
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from source with 1 make job # Install from source with 1 make job
nvm install -s -j 1 $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed" nvm install -s -j 1 $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] [ -d ../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
@@ -23,11 +23,11 @@ nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_T
# STAGE 2 # # STAGE 2 #
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from source with 2 make jobs (and swapped arg order) # Install from source with 2 make jobs (and swapped arg order)
nvm install -j 2 -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed" nvm install -j 2 -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] [ -d ../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@@ -2,12 +2,12 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Fake ARM arch # Fake ARM arch
nvm_get_arch() { nvm_get_arch() {
@@ -18,7 +18,7 @@ nvm_get_arch() {
nvm install -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed" nvm install -s $NVM_TEST_VERSION || die "'nvm install -s $NVM_TEST_VERSION' failed"
# Check Install # Check Install
[ -d ../../../$NVM_TEST_VERSION ] [ -d ../../$NVM_TEST_VERSION ]
node --version | grep $NVM_TEST_VERSION || "'node --version | grep $NVM_TEST_VERSION' failed" node --version | grep $NVM_TEST_VERSION || "'node --version | grep $NVM_TEST_VERSION' failed"
# Check V8 snapshot isn't compiled # Check V8 snapshot isn't compiled

View File

@@ -2,19 +2,19 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../v0.9.7 ] && rm -R ../../../v0.9.7 [ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12 [ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
# Install from binary # Install from binary
nvm install 0.9.7 || die "'nvm install 0.9.7' failed" nvm install 0.9.7 || die "'nvm install 0.9.7' failed"
nvm i 0.9.12 || die "'nvm i 0.9.12' failed" nvm i 0.9.12 || die "'nvm i 0.9.12' failed"
# Check # Check
[ -d ../../../v0.9.7 ] || die "v0.9.7 didn't exist" [ -d ../../v0.9.7 ] || die "v0.9.7 didn't exist"
[ -d ../../../v0.9.12 ] || die "v0.9.12 didn't exist" [ -d ../../v0.9.12 ] || die "v0.9.12 didn't exist"
# Use the first one # Use the first one
nvm use 0.9.7 || die "'nvm use 0.9.7' failed" nvm use 0.9.7 || die "'nvm use 0.9.7' failed"

View File

@@ -2,12 +2,12 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from binary # Install from binary
echo "$NVM_TEST_VERSION" > .nvmrc echo "$NVM_TEST_VERSION" > .nvmrc
@@ -15,7 +15,7 @@ echo "$NVM_TEST_VERSION" > .nvmrc
nvm install || die "'nvm install' failed" nvm install || die "'nvm install' failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] || die "./$NVM_TEST_VERSION did not exist" [ -d ../../$NVM_TEST_VERSION ] || die "./$NVM_TEST_VERSION did not exist"
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION \ nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION \
|| "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" || "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@@ -2,12 +2,12 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
NVM_TEST_VERSION=v0.10.7 NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from binary # Install from binary
echo "$NVM_TEST_VERSION" > .nvmrc echo "$NVM_TEST_VERSION" > .nvmrc
@@ -15,7 +15,7 @@ echo "$NVM_TEST_VERSION" > .nvmrc
nvm install -s || "'nvm install -s' failed" nvm install -s || "'nvm install -s' failed"
# Check # Check
[ -d ../../../$NVM_TEST_VERSION ] || die "$NVM_TEST_VERSION did not exist" [ -d ../../$NVM_TEST_VERSION ] || die "$NVM_TEST_VERSION did not exist"
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION \ nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION \
|| die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed" || die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"

View File

@@ -2,17 +2,17 @@
die () { echo $@ ; exit 1; } die () { echo $@ ; exit 1; }
. ../../../nvm.sh . ../../nvm.sh
# Remove the stuff we're clobbering. # Remove the stuff we're clobbering.
[ -e ../../../v0.9.7 ] && rm -R ../../../v0.9.7 [ -e ../../v0.9.7 ] && rm -R ../../v0.9.7
[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.12 [ -e ../../v0.9.12 ] && rm -R ../../v0.9.12
# Install from binary # Install from binary
nvm install 0.9.7 nvm install 0.9.7
# Check # Check
[ -d ../../../v0.9.7 ] || die "nvm install 0.9.7 didn't install" [ -d ../../v0.9.7 ] || die "nvm install 0.9.7 didn't install"
nvm use 0.9.7 nvm use 0.9.7
@@ -25,7 +25,7 @@ nvm ls 0.9 | grep v0.9.7 > /dev/null || die "nvm ls 0.9 didn't show v0.9.7"
nvm install 0.9.12 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed" nvm install 0.9.12 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed"
[ -d ../../../v0.9.12 ] || die "nvm install 0.9.12 didn't install" [ -d ../../v0.9.12 ] || die "nvm install 0.9.12 didn't install"
nvm use 0.9 nvm use 0.9
node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12" node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12"

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
. ../../../nvm.sh . ../../nvm.sh
nvm deactivate nvm deactivate
nvm uninstall v0.10.7 nvm uninstall v0.10.7