Compare commits
78 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d9c31d944 | ||
|
|
0acccb8a77 | ||
|
|
6354b170d7 | ||
|
|
5e065ec026 | ||
|
|
206d503a21 | ||
|
|
deb2a9b821 | ||
|
|
fb83eeb140 | ||
|
|
14179bc8ce | ||
|
|
153506c8da | ||
|
|
c1150c41ab | ||
|
|
ad1110ef1a | ||
|
|
914c220586 | ||
|
|
22d32bede0 | ||
|
|
a49d9163ef | ||
|
|
17586b971a | ||
|
|
f3fd5eff46 | ||
|
|
423252a99c | ||
|
|
2a294ebd61 | ||
|
|
a08d1ea4a3 | ||
|
|
217a5bb0de | ||
|
|
caf6208dbd | ||
|
|
0c2efed407 | ||
|
|
2d97ce5f7b | ||
|
|
8542df4ac5 | ||
|
|
f218a85454 | ||
|
|
96ebed37c7 | ||
|
|
e7a37f336d | ||
|
|
e06f735776 | ||
|
|
355c4c7915 | ||
|
|
4bd99bcfa2 | ||
|
|
5f9ccaada0 | ||
|
|
7ff20855a2 | ||
|
|
cdde74a55d | ||
|
|
17c33fd9ae | ||
|
|
04b35b5440 | ||
|
|
aacb0b9b97 | ||
|
|
f121e5ace0 | ||
|
|
af8038ffec | ||
|
|
265ec90532 | ||
|
|
e2195b4c35 | ||
|
|
41dc4218b9 | ||
|
|
90cfb5d771 | ||
|
|
0cdc184168 | ||
|
|
a5f42d9cea | ||
|
|
eabd7ab13d | ||
|
|
b111436fde | ||
|
|
9854928ba9 | ||
|
|
c50ea6f0a3 | ||
|
|
628d4fac84 | ||
|
|
ef35bc4cb6 | ||
|
|
d08d8607f5 | ||
|
|
e7b53a01fd | ||
|
|
b81c120e0c | ||
|
|
57ec311f53 | ||
|
|
38b32c27f3 | ||
|
|
7a5ff0d133 | ||
|
|
f5f029c409 | ||
|
|
c465a83518 | ||
|
|
62ee7cf998 | ||
|
|
113d807e5a | ||
|
|
3fc7b737f5 | ||
|
|
04c27e23fe | ||
|
|
592c0be195 | ||
|
|
93990ab7da | ||
|
|
61c7b133f8 | ||
|
|
eb0a8442d8 | ||
|
|
a26ab88478 | ||
|
|
1f2a3234d2 | ||
|
|
34e1ec800e | ||
|
|
177a9673a7 | ||
|
|
db98f8cdaf | ||
|
|
c983fefbae | ||
|
|
42f11acce1 | ||
|
|
09f7bbb78c | ||
|
|
d5dacdf80f | ||
|
|
d3a9272a0c | ||
|
|
685312d600 | ||
|
|
e7b42198b4 |
31
.github/ISSUE_TEMPLATE.md
vendored
31
.github/ISSUE_TEMPLATE.md
vendored
@@ -4,22 +4,22 @@
|
||||
- Operating system and version:
|
||||
|
||||
- `nvm debug` output:
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
|
||||
```sh
|
||||
```sh
|
||||
|
||||
```
|
||||
</details>
|
||||
```
|
||||
</details>
|
||||
|
||||
- `nvm ls` output:
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
|
||||
```sh
|
||||
```sh
|
||||
|
||||
```
|
||||
</details>
|
||||
```
|
||||
</details>
|
||||
|
||||
- How did you install `nvm`? (e.g. install script in readme, Homebrew):
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
|
||||
<!-- if this does not apply, please delete this section -->
|
||||
- If you are having installation issues, or getting "N/A", what does `curl -I --compressed -v https://nodejs.org/dist/` print out?
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
|
||||
```sh
|
||||
```
|
||||
</details>
|
||||
```sh
|
||||
|
||||
```
|
||||
</details>
|
||||
|
||||
20
.travis.yml
20
.travis.yml
@@ -10,6 +10,7 @@ addons:
|
||||
# - g++-4.8
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
- $TRAVIS_BUILD_DIR/.cache
|
||||
@@ -18,29 +19,34 @@ before_install:
|
||||
- $SHELL --version 2> /dev/null || dpkg -s $SHELL 2> /dev/null || which $SHELL
|
||||
- curl --version
|
||||
- wget --version
|
||||
- shellcheck --version
|
||||
install:
|
||||
- if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc eclint; fi
|
||||
- if [ -z "${SHELLCHECK-}" ]; then nvm install node && npm install && npm prune && npm ls urchin doctoc eclint dockerfile_lint; fi
|
||||
- '[ -z "$WITHOUT_CURL" ] || sudo apt-get remove curl -y'
|
||||
script:
|
||||
- if [ -n "${MAKE_RELEASE-}" ]; then export GIT_EDITOR="sed -i '1 s/^/99.99.99 make release test/'" && git fetch --unshallow --tags && echo proceed | make TAG=99.99.99 release ; fi
|
||||
- if [ -n "${DOCTOCCHECK-}" ]; then cp README.md README.md.orig && npm run doctoc && diff -q README.md README.md.orig ; fi
|
||||
- if [ -n "${ECLINT-}" ]; then npm run eclint ; fi
|
||||
- if [ -n "${DOCKERFILE_LINT-}" ]; then npm run dockerfile_lint ; fi
|
||||
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash nvm.sh && shellcheck -s sh nvm.sh && shellcheck -s dash nvm.sh && shellcheck -s ksh nvm.sh ; fi
|
||||
- if [ -n "${SHELLCHECK-}" ]; then shellcheck -s bash install.sh bash_completion nvm-exec ; fi
|
||||
- if [ -n "${SHELL-}" ] && [ -n "${TEST_SUITE}" ]; then if [ "${TEST_SUITE}" = 'installation_iojs' ]; then travis_retry make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL ; else make TEST_SUITE=$TEST_SUITE URCHIN="$(npm bin)/urchin" test-$SHELL; fi; fi
|
||||
before_cache:
|
||||
- if [ -n "$WITHOUT_CURL" ]; then sudo apt-get install curl -y ; fi
|
||||
- if [ -n "${NODE-}" ]; then . nvm.sh && set -ex && nvm install --latest-npm "${NODE}" && npm --version; fi
|
||||
env:
|
||||
global:
|
||||
- CXX=g++-4.8
|
||||
- CC=gcc-4.8
|
||||
- PATH="$(echo $PATH | sed 's/::/:/')"
|
||||
- PATH="/usr/lib/ccache/:$PATH"
|
||||
- NVM_DIR="${TRAVIS_BUILD_DIR}"
|
||||
matrix:
|
||||
- MAKE_RELEASE=true
|
||||
- DOCTOCCHECK=true
|
||||
- SHELLCHECK=true
|
||||
- ECLINT=true
|
||||
- DOCKERFILE_LINT=true
|
||||
- SHELL=bash TEST_SUITE=install_script
|
||||
- SHELL=sh TEST_SUITE=fast
|
||||
- SHELL=dash TEST_SUITE=fast
|
||||
@@ -77,3 +83,15 @@ env:
|
||||
- SHELL=zsh TEST_SUITE=installation_iojs WITHOUT_CURL=1
|
||||
# - SHELL=ksh TEST_SUITE=installation_iojs
|
||||
# - SHELL=ksh TEST_SUITE=installation_iojs WITHOUT_CURL=1
|
||||
- NODE=10 TEST="nvm install-latest-npm"
|
||||
- NODE=9 TEST="nvm install-latest-npm"
|
||||
- NODE=8 TEST="nvm install-latest-npm"
|
||||
- NODE=7 TEST="nvm install-latest-npm"
|
||||
- NODE=6 TEST="nvm install-latest-npm"
|
||||
- NODE=5 TEST="nvm install-latest-npm"
|
||||
- NODE=5.9 TEST="nvm install-latest-npm"
|
||||
- NODE=4 TEST="nvm install-latest-npm"
|
||||
- NODE=4.6 TEST="nvm install-latest-npm"
|
||||
- NODE=4.5 TEST="nvm install-latest-npm"
|
||||
- NODE=4.4 TEST="nvm install-latest-npm"
|
||||
- NODE=2 TEST="nvm install-latest-npm"
|
||||
|
||||
@@ -5,10 +5,12 @@ We love pull requests and issues, they're our favorite.
|
||||
However, before submitting, please review the following:
|
||||
|
||||
For bug reports:
|
||||
|
||||
- Please make sure the bug is reproducible, and give us the steps to reproduce it, so that we can dig into the problem.
|
||||
- Please give us as much detail as possible about your environment, so we can more easily confirm the problem.
|
||||
|
||||
For pull requests:
|
||||
|
||||
- Please include tests. Changes with tests will be merged very quickly.
|
||||
- Please manually confirm that your changes work in `bash`, `sh`/`dash`, `ksh`, and `zsh`. Fast tests do run in these shells, but it's nice to manually verify also.
|
||||
- Please maintain consistent whitespace - 2-space indentation, trailing newlines in all files, etc.
|
||||
|
||||
27
Dockerfile
27
Dockerfile
@@ -8,14 +8,19 @@
|
||||
|
||||
# Use Ubuntu Trusty Tahr as base image as we're using on Travis CI
|
||||
# I also tested with Ubuntu 16.04, should be good with it!
|
||||
From ubuntu:14.04
|
||||
MAINTAINER Peter Dave Hello <hsu@peterdavehello.org>
|
||||
FROM ubuntu:14.04
|
||||
LABEL maintainer="Peter Dave Hello <hsu@peterdavehello.org>"
|
||||
LABEL name="nvm-dev-env"
|
||||
LABEL version="latest"
|
||||
|
||||
# Set the SHELL to bash with pipefail option
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# Prevent dialog during apt install
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# ShellCheck version
|
||||
ENV SHELLCHECK_VERSION=0.4.7
|
||||
ENV SHELLCHECK_VERSION=0.5.0
|
||||
|
||||
# Pick a Ubuntu apt mirror site for better speed
|
||||
# ref: https://launchpad.net/ubuntu/+archivemirrors
|
||||
@@ -83,6 +88,10 @@ RUN wget --version
|
||||
# Add user "nvm" as non-root user
|
||||
RUN useradd -ms /bin/bash nvm
|
||||
|
||||
# Copy and set permission for nvm directory
|
||||
COPY . /home/nvm/.nvm/
|
||||
RUN chown nvm:nvm -R "home/nvm/.nvm"
|
||||
|
||||
# Set sudoer for "nvm"
|
||||
RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
|
||||
@@ -90,19 +99,17 @@ RUN echo 'nvm ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
USER nvm
|
||||
|
||||
# nvm
|
||||
COPY . /home/nvm/.nvm/
|
||||
RUN sudo chown nvm:nvm -R $HOME/.nvm
|
||||
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.bashrc
|
||||
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> $HOME/.bashrc
|
||||
RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> $HOME/.bashrc
|
||||
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> "$HOME/.bashrc"
|
||||
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "$HOME/.bashrc"
|
||||
RUN echo '[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> "$HOME/.bashrc"
|
||||
|
||||
# nodejs and tools
|
||||
RUN bash -c 'source $HOME/.nvm/nvm.sh && \
|
||||
nvm install node && \
|
||||
npm install -g doctoc urchin && \
|
||||
npm install -g doctoc urchin eclint dockerfile_lint && \
|
||||
npm install --prefix "$HOME/.nvm/"'
|
||||
|
||||
# Set WORKDIR to nvm directory
|
||||
WORKDIR /home/nvm/.nvm
|
||||
|
||||
ENTRYPOINT /bin/bash
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
|
||||
152
README.md
152
README.md
@@ -1,4 +1,4 @@
|
||||
# Node Version Manager [][3] [][4] [](https://bestpractices.coreinfrastructure.org/projects/684)
|
||||
# Node Version Manager [][3] [][4] [](https://bestpractices.coreinfrastructure.org/projects/684)
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Install script](#install-script)
|
||||
- [Ansible](#ansible)
|
||||
- [Verify installation](#verify-installation)
|
||||
- [Important Notes](#important-notes)
|
||||
- [Git install](#git-install)
|
||||
@@ -20,6 +21,8 @@
|
||||
- [Listing versions](#listing-versions)
|
||||
- [.nvmrc](#nvmrc)
|
||||
- [Deeper Shell Integration](#deeper-shell-integration)
|
||||
- [bash](#bash)
|
||||
- [Automatically call `nvm use`](#automatically-call-nvm-use)
|
||||
- [zsh](#zsh)
|
||||
- [Calling `nvm use` automatically in a directory with a `.nvmrc` file](#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file)
|
||||
- [License](#license)
|
||||
@@ -43,22 +46,26 @@
|
||||
To install or update nvm, you can use the [install script][2] using cURL:
|
||||
|
||||
```sh
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
```
|
||||
|
||||
or Wget:
|
||||
|
||||
```sh
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/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>**Note:** If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub>
|
||||
|
||||
```sh
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
export NVM_DIR="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
```
|
||||
|
||||
**Note:** You can add `--no-use` to the end of the above script (...`nvm.sh --no-use`) to postpone using `nvm` until you manually [`use`](#usage) it.
|
||||
|
||||
You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables.
|
||||
Eg: `curl ... | NVM_DIR="path/to/nvm"`. Ensure that the `NVM_DIR` does not contain a trailing slash.
|
||||
|
||||
@@ -69,11 +76,13 @@ Eg: `curl ... | NVM_DIR="path/to/nvm"`. Ensure that the `NVM_DIR` does not conta
|
||||
```sh
|
||||
command -v nvm
|
||||
```
|
||||
|
||||
simply close your current terminal, open a new terminal, and try verifying again.
|
||||
|
||||
**Note:** Since OS X 10.9, `/usr/bin/git` was preset by Xcode command line tools, which caused Git can't be properly detected if it's installed or not. You need to manually install the Xcode command line tools before running the install script, otherwise, it'll fail. (see [#1782](https://github.com/creationix/nvm/issues/1782))
|
||||
**Note:** Since OS X 10.9, `/usr/bin/git` has been preset by Xcode command line tools, which means we can't properly detect if Git is installed or not. You need to manually install the Xcode command line tools before running the install script, otherwise, it'll fail. (see [#1782](https://github.com/creationix/nvm/issues/1782))
|
||||
|
||||
**Note:** On OS X, if you get `nvm: command not found` after running the install script, one of the following might be the reason:-
|
||||
|
||||
- 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
|
||||
- you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.
|
||||
|
||||
@@ -83,6 +92,17 @@ If the above doesn't fix the problem, open your `.bash_profile` and add the foll
|
||||
|
||||
- For more information about this issue and possible workarounds, please [refer here](https://github.com/creationix/nvm/issues/576)
|
||||
|
||||
#### Ansible
|
||||
You can use a task:
|
||||
|
||||
```
|
||||
- name: nvm
|
||||
shell: >
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
args:
|
||||
creates: "{{ ansible_env.HOME }}/.nvm/nvm.sh"
|
||||
```
|
||||
|
||||
### Verify installation
|
||||
|
||||
To verify that nvm has been installed, do:
|
||||
@@ -98,23 +118,29 @@ which should output 'nvm' if the installation was successful. Please note that `
|
||||
If you're running a system without prepackaged binary available, which means you're going to install nodejs or io.js from its source code, you need to make sure your system has a C++ compiler. For OS X, Xcode will work, for Debian/Ubuntu based GNU/Linux, 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:
|
||||
|
||||
- [nvm-windows](https://github.com/coreybutler/nvm-windows)
|
||||
- [nodist](https://github.com/marcelklehr/nodist)
|
||||
|
||||
**Note:** `nvm` does not support [Fish] either (see [#303](https://github.com/creationix/nvm/issues/303)). Alternatives exist, which are neither supported nor developed by us:
|
||||
|
||||
- [bass](https://github.com/edc/bass) allows you to use utilities written for Bash in fish shell
|
||||
- [fast-nvm-fish](https://github.com/brigand/fast-nvm-fish) only works with version numbers (not aliases) but doesn't significantly slow your shell startup
|
||||
- [plugin-nvm](https://github.com/derekstavis/plugin-nvm) plugin for [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish), which makes nvm and its completions available in fish shell
|
||||
- [fnm](https://github.com/fisherman/fnm) - [fisherman](https://github.com/fisherman/fisherman)-based version manager for fish
|
||||
- [fish-nvm](https://github.com/FabioAntunes/fish-nvm) - Wrapper around nvm for fish, delays sourcing nvm until it's actually used.
|
||||
|
||||
**Note:** We still have some problems with FreeBSD, because there is no official pre-built binary for FreeBSD, and building from source may need [patches](https://www.freshports.org/www/node/files/patch-deps_v8_src_base_platform_platform-posix.cc); see the issue ticket:
|
||||
- [[#900] [Bug] nodejs on FreeBSD may need to be patched ](https://github.com/creationix/nvm/issues/900)
|
||||
|
||||
- [[#900] [Bug] nodejs on FreeBSD may need to be patched](https://github.com/creationix/nvm/issues/900)
|
||||
- [nodejs/node#3716](https://github.com/nodejs/node/issues/3716)
|
||||
|
||||
**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/)
|
||||
|
||||
**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/*`
|
||||
@@ -131,8 +157,8 @@ If you have `git` installed (requires git v1.7.10+):
|
||||
|
||||
1. clone this repo in the root of your user profile
|
||||
- `cd ~/` from anywhere then `git clone https://github.com/creationix/nvm.git .nvm`
|
||||
2. `cd ~/.nvm` and check out the latest version with `git checkout v0.33.9`
|
||||
3. activate nvm by sourcing it from your shell: `. nvm.sh`
|
||||
1. `cd ~/.nvm` and check out the latest version with `git checkout v0.34.0`
|
||||
1. activate nvm by sourcing it from your shell: `. nvm.sh`
|
||||
|
||||
Now 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)
|
||||
@@ -145,7 +171,7 @@ export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
### Manual Install
|
||||
|
||||
For a fully manual install, create a folder somewhere in your filesystem with the `nvm.sh` file inside it. I put mine in `~/.nvm` and added the following to the `nvm.sh` file.
|
||||
For a fully manual install, execute the following lines to first clone the nvm repository into `$HOME/.nvm`, and then load nvm:
|
||||
|
||||
```sh
|
||||
export NVM_DIR="$HOME/.nvm" && (
|
||||
@@ -175,7 +201,7 @@ For manual upgrade with `git` (requires git v1.7.10+):
|
||||
```sh
|
||||
(
|
||||
cd "$NVM_DIR"
|
||||
git fetch origin
|
||||
git fetch --tags origin
|
||||
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
|
||||
) && \. "$NVM_DIR/nvm.sh"
|
||||
```
|
||||
@@ -185,7 +211,19 @@ For manual upgrade with `git` (requires git v1.7.10+):
|
||||
To download, compile, and install the latest release of node, do this:
|
||||
|
||||
```sh
|
||||
nvm install node
|
||||
nvm install node # "node" is an alias for the latest version
|
||||
```
|
||||
|
||||
To install a specific version of node:
|
||||
|
||||
```sh
|
||||
nvm install 6.14.4 # or 10.10.0, 8.9.1, etc
|
||||
```
|
||||
|
||||
You can list available versions using ls-remote:
|
||||
|
||||
```sh
|
||||
nvm ls-remote
|
||||
```
|
||||
|
||||
And then in any new shell just use the installed version:
|
||||
@@ -199,6 +237,7 @@ Or you can just run it:
|
||||
```sh
|
||||
nvm run node --version
|
||||
```
|
||||
|
||||
Or, you can run any arbitrary command in a subshell with the desired version of node:
|
||||
|
||||
```sh
|
||||
@@ -219,7 +258,9 @@ In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the f
|
||||
- `unstable`: this alias points to `node` `v0.11` - the last "unstable" node release, since post-1.0, all node versions are stable. (in SemVer, versions communicate breakage, not stability).
|
||||
|
||||
### Long-term support
|
||||
|
||||
Node has a [schedule](https://github.com/nodejs/LTS#lts_schedule) for long-term support (LTS) You can reference LTS versions in aliases and `.nvmrc` files with the notation `lts/*` for the latest LTS, and `lts/argon` for LTS releases from the "argon" line, for example. In addition, the following commands support LTS arguments:
|
||||
|
||||
- `nvm install --lts` / `nvm install --lts=argon` / `nvm install 'lts/*'` / `nvm install lts/argon`
|
||||
- `nvm uninstall --lts` / `nvm uninstall --lts=argon` / `nvm uninstall 'lts/*'` / `nvm uninstall lts/argon`
|
||||
- `nvm use --lts` / `nvm use --lts=argon` / `nvm use 'lts/*'` / `nvm use lts/argon`
|
||||
@@ -231,6 +272,7 @@ Node has a [schedule](https://github.com/nodejs/LTS#lts_schedule) for long-term
|
||||
Any time your local copy of `nvm` connects to https://nodejs.org, it will re-create the appropriate local aliases for all available LTS lines. These aliases (stored under `$NVM_DIR/alias/lts`), are managed by `nvm`, and you should not modify, remove, or create these files - expect your changes to be undone, and expect meddling with these files to cause bugs that will likely not be supported.
|
||||
|
||||
### Migrating global packages while installing
|
||||
|
||||
If you want to install a new version of Node.js and migrate npm packages from a previous version:
|
||||
|
||||
```sh
|
||||
@@ -259,6 +301,7 @@ stevemao/left-pad
|
||||
```
|
||||
|
||||
### io.js
|
||||
|
||||
If you want to install [io.js](https://github.com/iojs/io.js/):
|
||||
|
||||
```sh
|
||||
@@ -274,6 +317,7 @@ nvm install iojs --reinstall-packages-from=iojs
|
||||
The same guidelines mentioned for migrating npm packages in Node.js are applicable to io.js.
|
||||
|
||||
### System version of node
|
||||
|
||||
If you want to use the system-installed version of node, you can use the special default alias "system":
|
||||
|
||||
```sh
|
||||
@@ -282,6 +326,7 @@ nvm run system --version
|
||||
```
|
||||
|
||||
### Listing versions
|
||||
|
||||
If you want to see what versions are installed:
|
||||
|
||||
```sh
|
||||
@@ -359,6 +404,67 @@ You can use [`avn`](https://github.com/wbyoung/avn) to deeply integrate into you
|
||||
|
||||
If you prefer a lighter-weight solution, the recipes below have been contributed by `nvm` users. They are **not** supported by the `nvm` development team. We are, however, accepting pull requests for more examples.
|
||||
|
||||
#### bash
|
||||
|
||||
##### Automatically call `nvm use`
|
||||
|
||||
Put the following at the end of your `$HOME/.bashrc`:
|
||||
|
||||
```bash
|
||||
find-up () {
|
||||
path=$(pwd)
|
||||
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
|
||||
path=${path%/*}
|
||||
done
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
cdnvm(){
|
||||
cd "$@";
|
||||
nvm_path=$(find-up .nvmrc | tr -d '[:space:]')
|
||||
|
||||
# If there are no .nvmrc file, use the default nvm version
|
||||
if [[ ! $nvm_path = *[^[:space:]]* ]]; then
|
||||
|
||||
declare default_version;
|
||||
default_version=$(nvm version default);
|
||||
|
||||
# If there is no default version, set it to `node`
|
||||
# This will use the latest version on your machine
|
||||
if [[ $default_version == "N/A" ]]; then
|
||||
nvm alias default node;
|
||||
default_version=$(nvm version default);
|
||||
fi
|
||||
|
||||
# If the current version is not the default version, set it to use the default version
|
||||
if [[ $(nvm current) != "$default_version" ]]; then
|
||||
nvm use default;
|
||||
fi
|
||||
|
||||
elif [[ -s $nvm_path/.nvmrc && -r $nvm_path/.nvmrc ]]; then
|
||||
declare nvm_version
|
||||
nvm_version=$(<"$nvm_path"/.nvmrc)
|
||||
|
||||
# Add the `v` suffix if it does not exists in the .nvmrc file
|
||||
if [[ $nvm_version != v* ]]; then
|
||||
nvm_version="v""$nvm_version"
|
||||
fi
|
||||
|
||||
# If it is not already installed, install it
|
||||
if [[ $(nvm ls "$nvm_version" | tr -d '[:space:]') == "N/A" ]]; then
|
||||
nvm install "$nvm_version";
|
||||
fi
|
||||
|
||||
if [[ $(nvm current) != "$nvm_version" ]]; then
|
||||
nvm use "$nvm_version";
|
||||
fi
|
||||
fi
|
||||
}
|
||||
alias cd='cdnvm'
|
||||
```
|
||||
|
||||
This alias would search 'up' from your current directory in order to detect a `.nvmrc` file. If it finds it, it will switch to that version; if not, it will use the default version.
|
||||
|
||||
#### zsh
|
||||
|
||||
##### Calling `nvm use` automatically in a directory with a `.nvmrc` file
|
||||
@@ -404,6 +510,7 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
## Running tests
|
||||
|
||||
Tests are written in [Urchin]. Install Urchin (and other dependencies) like so:
|
||||
|
||||
npm install
|
||||
@@ -439,6 +546,7 @@ Put the above sourcing line just below the sourcing line for nvm in your profile
|
||||
|
||||
nvm:
|
||||
> $ nvm <kbd>Tab</kbd>
|
||||
|
||||
```
|
||||
alias deactivate install ls run unload
|
||||
clear-cache exec list ls-remote unalias use
|
||||
@@ -447,46 +555,57 @@ current help list-remote reinstall-packages
|
||||
|
||||
nvm alias:
|
||||
> $ nvm alias <kbd>Tab</kbd>
|
||||
|
||||
```
|
||||
default
|
||||
```
|
||||
|
||||
> $ nvm alias my_alias <kbd>Tab</kbd>
|
||||
|
||||
```
|
||||
v0.6.21 v0.8.26 v0.10.28
|
||||
```
|
||||
|
||||
nvm use:
|
||||
> $ nvm use <kbd>Tab</kbd>
|
||||
|
||||
```
|
||||
my_alias default v0.6.21 v0.8.26 v0.10.28
|
||||
```
|
||||
|
||||
nvm uninstall:
|
||||
> $ nvm uninstall <kbd>Tab</kbd>
|
||||
|
||||
```
|
||||
my_alias default v0.6.21 v0.8.26 v0.10.28
|
||||
```
|
||||
|
||||
## Compatibility Issues
|
||||
|
||||
`nvm` will encounter some issues if you have some non-default settings set. (see [#606](/../../issues/606))
|
||||
The following are known to cause issues:
|
||||
|
||||
Inside `~/.npmrc`:
|
||||
|
||||
```sh
|
||||
prefix='some/path'
|
||||
```
|
||||
|
||||
Environment Variables:
|
||||
|
||||
```sh
|
||||
$NPM_CONFIG_PREFIX
|
||||
$PREFIX
|
||||
```
|
||||
|
||||
Shell settings:
|
||||
|
||||
```sh
|
||||
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.
|
||||
@@ -497,7 +616,7 @@ If installing nvm on Alpine Linux *is* still what you want or need to do, you sh
|
||||
|
||||
```sh
|
||||
apk add -U curl bash ca-certificates openssl ncurses coreutils python2 make gcc g++ libgcc linux-headers grep util-linux binutils findutils
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | 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.
|
||||
@@ -509,11 +628,13 @@ As a potential alternative, @mhart (a Node contributor) has some [Docker images
|
||||
### Manual Uninstall
|
||||
|
||||
To remove nvm manually, execute the following:
|
||||
|
||||
```sh
|
||||
$ rm -rf "$NVM_DIR"
|
||||
```
|
||||
|
||||
Edit ~/.bashrc (or other shell resource config) and remove the lines below:
|
||||
|
||||
```sh
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
@@ -540,7 +661,7 @@ nvm-dev latest 9ca4c57a97d8 7 days ago 6
|
||||
If you got no error message, now you can easily involve in:
|
||||
|
||||
```sh
|
||||
$ docker run -it nvm-dev -h nvm-dev
|
||||
$ docker run -h nvm-dev -it nvm-dev
|
||||
|
||||
nvm@nvm-dev:~/.nvm$
|
||||
```
|
||||
@@ -548,6 +669,7 @@ nvm@nvm-dev:~/.nvm$
|
||||
Please note that it'll take about 8 minutes to build the image and the image size would be about 650MB, so it's not suitable for production usage.
|
||||
|
||||
For more information and documentation about docker, please refer to its official website:
|
||||
|
||||
- https://www.docker.com/
|
||||
- https://docs.docker.com/
|
||||
|
||||
@@ -580,8 +702,8 @@ sudo chmod ugo-x /usr/libexec/path_helper
|
||||
More on this issue in [dotphiles/dotzsh](https://github.com/dotphiles/dotzsh#mac-os-x).
|
||||
|
||||
[1]: https://github.com/creationix/nvm.git
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.33.9/install.sh
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.34.0/install.sh
|
||||
[3]: https://travis-ci.org/creationix/nvm
|
||||
[4]: https://github.com/creationix/nvm/releases/tag/v0.33.9
|
||||
[4]: https://github.com/creationix/nvm/releases/tag/v0.34.0
|
||||
[Urchin]: https://github.com/scraperwiki/urchin
|
||||
[Fish]: http://fishshell.com
|
||||
|
||||
@@ -6,17 +6,15 @@ if ! command -v nvm &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
__nvm_generate_completion()
|
||||
{
|
||||
__nvm_generate_completion() {
|
||||
declare current_word
|
||||
current_word="${COMP_WORDS[COMP_CWORD]}"
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "$1" -- "$current_word"))
|
||||
COMPREPLY=($(compgen -W "$1" -- "${current_word}"))
|
||||
return 0
|
||||
}
|
||||
|
||||
__nvm_commands ()
|
||||
{
|
||||
__nvm_commands() {
|
||||
declare current_word
|
||||
declare command
|
||||
|
||||
@@ -32,7 +30,7 @@ __nvm_commands ()
|
||||
|
||||
if [ ${#COMP_WORDS[@]} == 4 ]; then
|
||||
|
||||
command="${COMP_WORDS[COMP_CWORD-2]}"
|
||||
command="${COMP_WORDS[COMP_CWORD - 2]}"
|
||||
case "${command}" in
|
||||
alias) __nvm_installed_nodes ;;
|
||||
esac
|
||||
@@ -41,46 +39,41 @@ __nvm_commands ()
|
||||
|
||||
case "${current_word}" in
|
||||
-*) __nvm_options ;;
|
||||
*) __nvm_generate_completion "$COMMANDS" ;;
|
||||
*) __nvm_generate_completion "${COMMANDS}" ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
__nvm_options ()
|
||||
{
|
||||
__nvm_options() {
|
||||
OPTIONS=''
|
||||
__nvm_generate_completion "$OPTIONS"
|
||||
__nvm_generate_completion "${OPTIONS}"
|
||||
}
|
||||
|
||||
__nvm_installed_nodes ()
|
||||
{
|
||||
__nvm_installed_nodes() {
|
||||
__nvm_generate_completion "$(nvm_ls) $(__nvm_aliases)"
|
||||
}
|
||||
|
||||
__nvm_aliases ()
|
||||
{
|
||||
__nvm_aliases() {
|
||||
declare aliases
|
||||
aliases=""
|
||||
if [ -d "$NVM_DIR/alias" ]; then
|
||||
aliases="$(cd "$NVM_DIR/alias" && command find "$PWD" -type f | command sed "s:$PWD/::")"
|
||||
if [ -d "${NVM_DIR}/alias" ]; then
|
||||
aliases="$(cd "${NVM_DIR}/alias" && command find "${PWD}" -type f | command sed "s:${PWD}/::")"
|
||||
fi
|
||||
echo "${aliases} node stable unstable iojs"
|
||||
}
|
||||
|
||||
__nvm_alias ()
|
||||
{
|
||||
__nvm_alias() {
|
||||
__nvm_generate_completion "$(__nvm_aliases)"
|
||||
}
|
||||
|
||||
__nvm ()
|
||||
{
|
||||
__nvm() {
|
||||
declare previous_word
|
||||
previous_word="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
previous_word="${COMP_WORDS[COMP_CWORD - 1]}"
|
||||
|
||||
case "$previous_word" in
|
||||
use|run|exec|ls|list|uninstall) __nvm_installed_nodes ;;
|
||||
alias|unalias) __nvm_alias ;;
|
||||
case "${previous_word}" in
|
||||
use | run | exec | ls | list | uninstall) __nvm_installed_nodes ;;
|
||||
alias | unalias) __nvm_alias ;;
|
||||
*) __nvm_commands ;;
|
||||
esac
|
||||
|
||||
@@ -92,7 +85,11 @@ __nvm ()
|
||||
# ZSH, load and run bashcompinit before calling the complete function.
|
||||
if [[ -n ${ZSH_VERSION-} ]]; then
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
autoload -U +X compinit && compinit
|
||||
autoload -U +X compinit && if [[ ${ZSH_DISABLE_COMPFIX-} = true ]]; then
|
||||
compinit -u
|
||||
else
|
||||
compinit
|
||||
fi
|
||||
fi
|
||||
|
||||
complete -o default -F __nvm nvm
|
||||
|
||||
22
install.sh
22
install.sh
@@ -7,11 +7,17 @@ nvm_has() {
|
||||
}
|
||||
|
||||
nvm_install_dir() {
|
||||
command printf %s "${NVM_DIR:-"$HOME/.nvm"}"
|
||||
if [ -n "$NVM_DIR" ]; then
|
||||
printf %s "${NVM_DIR}"
|
||||
elif [ -n "$XDG_CONFIG_HOME" ]; then
|
||||
printf %s "${XDG_CONFIG_HOME/nvm}"
|
||||
else
|
||||
printf %s "$HOME/.nvm"
|
||||
fi
|
||||
}
|
||||
|
||||
nvm_latest_version() {
|
||||
echo "v0.33.9"
|
||||
echo "v0.34.0"
|
||||
}
|
||||
|
||||
nvm_profile_is_bash_or_zsh() {
|
||||
@@ -117,7 +123,7 @@ install_nvm_from_git() {
|
||||
fi
|
||||
fi
|
||||
command git -c advice.detachedHead=false --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout -f --quiet "$(nvm_latest_version)"
|
||||
if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
|
||||
if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
|
||||
if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
|
||||
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
|
||||
else
|
||||
@@ -212,6 +218,11 @@ nvm_try_profile() {
|
||||
# Otherwise, an empty string is returned
|
||||
#
|
||||
nvm_detect_profile() {
|
||||
if [ "${PROFILE-}" = '/dev/null' ]; then
|
||||
# the user has specifically requested NOT to have nvm touch their profile
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "${PROFILE}" ] && [ -f "${PROFILE}" ]; then
|
||||
echo "${PROFILE}"
|
||||
return
|
||||
@@ -239,7 +250,7 @@ nvm_detect_profile() {
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -z "$DETECTED_PROFILE" ]; then
|
||||
if [ -n "$DETECTED_PROFILE" ]; then
|
||||
echo "$DETECTED_PROFILE"
|
||||
fi
|
||||
}
|
||||
@@ -318,6 +329,9 @@ nvm_do_install() {
|
||||
exit 1
|
||||
fi
|
||||
install_nvm_as_script
|
||||
else
|
||||
echo >&2 "The environment variable \$METHOD is set to \"${METHOD}\", which is not recognized as a valid installation method."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
247
nvm.sh
247
nvm.sh
@@ -12,6 +12,10 @@
|
||||
|
||||
NVM_SCRIPT_SOURCE="$_"
|
||||
|
||||
nvm_is_zsh() {
|
||||
[ -n "${ZSH_VERSION-}" ]
|
||||
}
|
||||
|
||||
nvm_echo() {
|
||||
command printf %s\\n "$*" 2>/dev/null
|
||||
}
|
||||
@@ -48,10 +52,12 @@ nvm_command_info() {
|
||||
local INFO
|
||||
COMMAND="${1}"
|
||||
if type "${COMMAND}" | nvm_grep -q hashed; then
|
||||
INFO="$(type "${COMMAND}" | command sed -E 's/\(|)//g' | command awk '{print $4}')"
|
||||
INFO="$(type "${COMMAND}" | command sed -E 's/\(|\)//g' | command awk '{print $4}')"
|
||||
elif type "${COMMAND}" | nvm_grep -q aliased; then
|
||||
# shellcheck disable=SC2230
|
||||
INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4="" ;print }' | command sed -e 's/^\ *//g' -Ee "s/\`|'//g" ))"
|
||||
elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is an alias for"; then
|
||||
# shellcheck disable=SC2230
|
||||
INFO="$(which "${COMMAND}") ($(type "${COMMAND}" | command awk '{ $1=$2=$3=$4=$5="" ;print }' | command sed 's/^\ *//g'))"
|
||||
elif type "${COMMAND}" | nvm_grep -q "^${COMMAND} is \\/"; then
|
||||
INFO="$(type "${COMMAND}" | command awk '{print $3}')"
|
||||
@@ -113,6 +119,7 @@ nvm_download() {
|
||||
-e 's/-L //' \
|
||||
-e 's/-I /--server-response /' \
|
||||
-e 's/-s /-q /' \
|
||||
-e 's/-sS /-nv /' \
|
||||
-e 's/-o /-O /' \
|
||||
-e 's/-C - /-c /')
|
||||
# shellcheck disable=SC2086
|
||||
@@ -129,7 +136,7 @@ nvm_has_system_iojs() {
|
||||
}
|
||||
|
||||
nvm_is_version_installed() {
|
||||
[ -n "${1-}" ] && [ -d "$(nvm_version_path "${1-}" 2> /dev/null)" ]
|
||||
[ -n "${1-}" ] && [ -x "$(nvm_version_path "$1" 2> /dev/null)"/bin/node ]
|
||||
}
|
||||
|
||||
nvm_print_npm_version() {
|
||||
@@ -206,15 +213,29 @@ nvm_install_latest_npm() {
|
||||
NVM_IS_4_4_OR_BELOW=1
|
||||
fi
|
||||
|
||||
local NVM_IS_5_OR_ABOVE
|
||||
NVM_IS_5_OR_ABOVE=0
|
||||
if [ $NVM_IS_4_4_OR_BELOW -eq 0 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 5.0.0; then
|
||||
NVM_IS_5_OR_ABOVE=1
|
||||
fi
|
||||
|
||||
local NVM_IS_6_OR_ABOVE
|
||||
NVM_IS_6_OR_ABOVE=0
|
||||
if [ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 6.0.0; then
|
||||
NVM_IS_6_OR_ABOVE=1
|
||||
fi
|
||||
|
||||
if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || (\
|
||||
nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 5.0.0 \
|
||||
&& nvm_version_greater 5.10.0 "${NODE_VERSION}"\
|
||||
[ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}"\
|
||||
); then
|
||||
nvm_echo '* `npm` `v5.3.x` is the last version that works on `node` 4.x versions below v4.4, or 5.x versions below v5.10, due to `Buffer.alloc`'
|
||||
$NVM_NPM_CMD install -g npm@5.3
|
||||
elif [ $NVM_IS_4_4_OR_BELOW -eq 0 ] && nvm_version_greater 4.7.0 "${NODE_VERSION}"; then
|
||||
nvm_echo '* `npm` `v5.4.x` is the last version that works on `node` `v4.5` and `v4.6`'
|
||||
$NVM_NPM_CMD install -g npm@5.4
|
||||
nvm_echo '* `npm` `v5.4.1` is the last version that works on `node` `v4.5` and `v4.6`'
|
||||
$NVM_NPM_CMD install -g npm@5.4.1
|
||||
elif [ $NVM_IS_6_OR_ABOVE -eq 0 ]; then
|
||||
nvm_echo '* `npm` `v5.x` is the last version that works on `node` below `v6.0.0`'
|
||||
$NVM_NPM_CMD install -g npm@5
|
||||
else
|
||||
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'
|
||||
$NVM_NPM_CMD install -g npm
|
||||
@@ -228,8 +249,7 @@ nvm_install_latest_npm() {
|
||||
if [ -z "${NVM_CD_FLAGS-}" ]; then
|
||||
export NVM_CD_FLAGS=''
|
||||
fi
|
||||
if nvm_has "unsetopt"; then
|
||||
unsetopt nomatch 2>/dev/null
|
||||
if nvm_is_zsh; then
|
||||
NVM_CD_FLAGS="-q"
|
||||
fi
|
||||
|
||||
@@ -243,6 +263,15 @@ if [ -z "${NVM_DIR-}" ]; then
|
||||
# shellcheck disable=SC1001
|
||||
NVM_DIR="$(nvm_cd ${NVM_CD_FLAGS} "$(dirname "${NVM_SCRIPT_SOURCE:-$0}")" > /dev/null && \pwd)"
|
||||
export NVM_DIR
|
||||
else
|
||||
# https://unix.stackexchange.com/a/198289
|
||||
case $NVM_DIR in
|
||||
*[!/]*/)
|
||||
NVM_DIR="${NVM_DIR%"${NVM_DIR##*[!/]}"}"
|
||||
export NVM_DIR
|
||||
nvm_err "Warning: \$NVM_DIR should not have trailing slashes"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
unset NVM_SCRIPT_SOURCE 2> /dev/null
|
||||
|
||||
@@ -293,8 +322,8 @@ nvm_rc_version() {
|
||||
nvm_err "No .nvmrc file found"
|
||||
return 1
|
||||
fi
|
||||
read -r NVM_RC_VERSION < "${NVMRC_PATH}" || command printf ''
|
||||
if [ ! -n "${NVM_RC_VERSION}" ]; then
|
||||
NVM_RC_VERSION="$(command head -n 1 "${NVMRC_PATH}" | command tr -d '\r')" || command printf ''
|
||||
if [ -z "${NVM_RC_VERSION}" ]; then
|
||||
nvm_err "Warning: empty .nvmrc file found at \"${NVMRC_PATH}\""
|
||||
return 2
|
||||
fi
|
||||
@@ -509,9 +538,9 @@ nvm_remote_versions() {
|
||||
NVM_LS_REMOTE_IOJS_EXIT_CODE=0
|
||||
local NVM_LS_REMOTE_IOJS_OUTPUT
|
||||
NVM_LS_REMOTE_IOJS_OUTPUT=''
|
||||
if [ -z "${NVM_LTS-}" ] && ( \
|
||||
[ -z "${NVM_FLAVOR-}" ] || [ "${NVM_FLAVOR-}" = "${NVM_IOJS_PREFIX}" ] \
|
||||
); then
|
||||
if [ -z "${NVM_LTS-}" ] && {
|
||||
[ -z "${NVM_FLAVOR-}" ] || [ "${NVM_FLAVOR-}" = "${NVM_IOJS_PREFIX}" ];
|
||||
}; then
|
||||
NVM_LS_REMOTE_IOJS_OUTPUT=$(nvm_ls_remote_iojs "${PATTERN-}") &&:
|
||||
NVM_LS_REMOTE_IOJS_EXIT_CODE=$?
|
||||
fi
|
||||
@@ -614,12 +643,19 @@ nvm_change_path() {
|
||||
elif ! nvm_echo "${1-}" | nvm_grep -q "${NVM_DIR}/[^/]*${2-}" \
|
||||
&& ! nvm_echo "${1-}" | nvm_grep -q "${NVM_DIR}/versions/[^/]*/[^/]*${2-}"; then
|
||||
nvm_echo "${3-}${2-}:${1-}"
|
||||
# if the initial path contains BOTH an nvm path (checked for above) and
|
||||
# that nvm path is preceded by a system binary path, just prepend the
|
||||
# supplementary path instead of replacing it.
|
||||
# https://github.com/creationix/nvm/issues/1652#issuecomment-342571223
|
||||
elif nvm_echo "${1-}" | nvm_grep -Eq "(^|:)(/usr(/local)?)?${2-}:.*${NVM_DIR}/[^/]*${2-}" \
|
||||
|| nvm_echo "${1-}" | nvm_grep -Eq "(^|:)(/usr(/local)?)?${2-}:.*${NVM_DIR}/versions/[^/]*/[^/]*${2-}"; then
|
||||
nvm_echo "${3-}${2-}:${1-}"
|
||||
# use sed to replace the existing nvm path with the supplementary path. This
|
||||
# preserves the order of the path.
|
||||
else
|
||||
nvm_echo "${1-}" | command sed \
|
||||
-e "s#${NVM_DIR}/[^/]*${2-}[^:]*#${3-}${2-}#g" \
|
||||
-e "s#${NVM_DIR}/versions/[^/]*/[^/]*${2-}[^:]*#${3-}${2-}#g"
|
||||
-e "s#${NVM_DIR}/[^/]*${2-}[^:]*#${3-}${2-}#" \
|
||||
-e "s#${NVM_DIR}/versions/[^/]*/[^/]*${2-}[^:]*#${3-}${2-}#"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -747,25 +783,42 @@ nvm_list_aliases() {
|
||||
NVM_ALIAS_DIR="$(nvm_alias_path)"
|
||||
command mkdir -p "${NVM_ALIAS_DIR}/lts"
|
||||
|
||||
(
|
||||
local ALIAS_PATH
|
||||
for ALIAS_PATH in "${NVM_ALIAS_DIR}/${ALIAS}"*; do
|
||||
NVM_NO_COLORS="${NVM_NO_COLORS-}" NVM_CURRENT="${NVM_CURRENT}" nvm_print_alias_path "${NVM_ALIAS_DIR}" "${ALIAS_PATH}"
|
||||
NVM_NO_COLORS="${NVM_NO_COLORS-}" NVM_CURRENT="${NVM_CURRENT}" nvm_print_alias_path "${NVM_ALIAS_DIR}" "${ALIAS_PATH}" &
|
||||
done
|
||||
wait
|
||||
) | sort
|
||||
|
||||
(
|
||||
local ALIAS_NAME
|
||||
for ALIAS_NAME in "$(nvm_node_prefix)" "stable" "unstable" "$(nvm_iojs_prefix)"; do
|
||||
if [ ! -f "${NVM_ALIAS_DIR}/${ALIAS_NAME}" ] && ([ -z "${ALIAS}" ] || [ "${ALIAS_NAME}" = "${ALIAS}" ]); then
|
||||
for ALIAS_NAME in "$(nvm_node_prefix)" "stable" "unstable"; do
|
||||
{
|
||||
if [ ! -f "${NVM_ALIAS_DIR}/${ALIAS_NAME}" ] && { [ -z "${ALIAS}" ] || [ "${ALIAS_NAME}" = "${ALIAS}" ]; }; then
|
||||
NVM_NO_COLORS="${NVM_NO_COLORS-}" NVM_CURRENT="${NVM_CURRENT}" nvm_print_default_alias "${ALIAS_NAME}"
|
||||
fi
|
||||
} &
|
||||
done
|
||||
wait
|
||||
ALIAS_NAME="$(nvm_iojs_prefix)"
|
||||
if [ ! -f "${NVM_ALIAS_DIR}/${ALIAS_NAME}" ] && { [ -z "${ALIAS}" ] || [ "${ALIAS_NAME}" = "${ALIAS}" ]; }; then
|
||||
NVM_NO_COLORS="${NVM_NO_COLORS-}" NVM_CURRENT="${NVM_CURRENT}" nvm_print_default_alias "${ALIAS_NAME}"
|
||||
fi
|
||||
) | sort
|
||||
|
||||
(
|
||||
local LTS_ALIAS
|
||||
for ALIAS_PATH in "${NVM_ALIAS_DIR}/lts/${ALIAS}"*; do
|
||||
{
|
||||
LTS_ALIAS="$(NVM_NO_COLORS="${NVM_NO_COLORS-}" NVM_LTS=true nvm_print_alias_path "${NVM_ALIAS_DIR}" "${ALIAS_PATH}")"
|
||||
if [ -n "${LTS_ALIAS}" ]; then
|
||||
nvm_echo "${LTS_ALIAS}"
|
||||
fi
|
||||
} &
|
||||
done
|
||||
wait
|
||||
) | sort
|
||||
return
|
||||
}
|
||||
|
||||
@@ -969,12 +1022,7 @@ nvm_ls() {
|
||||
;;
|
||||
esac
|
||||
|
||||
local ZSH_HAS_SHWORDSPLIT_UNSET
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
|
||||
local NVM_DIRS_TO_SEARCH1
|
||||
NVM_DIRS_TO_SEARCH1=''
|
||||
@@ -1040,10 +1088,6 @@ nvm_ls() {
|
||||
-e "s#^${NVM_NODE_PREFIX}-##;" \
|
||||
)"
|
||||
fi
|
||||
|
||||
if [ "${ZSH_HAS_SHWORDSPLIT_UNSET}" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${NVM_ADD_SYSTEM-}" = true ]; then
|
||||
@@ -1066,7 +1110,13 @@ nvm_ls_remote() {
|
||||
local PATTERN
|
||||
PATTERN="${1-}"
|
||||
if nvm_validate_implicit_alias "${PATTERN}" 2> /dev/null ; then
|
||||
PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$(nvm_print_implicit_alias remote "${PATTERN}")" | command tail -1 | command awk '{ print $1 }')"
|
||||
local IMPLICIT
|
||||
IMPLICIT="$(nvm_print_implicit_alias remote "${PATTERN}")"
|
||||
if [ -z "${IMPLICIT-}" ] || [ "${IMPLICIT}" = 'N/A' ]; then
|
||||
nvm_echo "N/A"
|
||||
return 3
|
||||
fi
|
||||
PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "${IMPLICIT}" | command tail -1 | command awk '{ print $1 }')"
|
||||
elif [ -n "${PATTERN}" ]; then
|
||||
PATTERN="$(nvm_ensure_version_prefix "${PATTERN}")"
|
||||
else
|
||||
@@ -1134,11 +1184,7 @@ nvm_ls_remote_index_tab() {
|
||||
unset PATTERN
|
||||
fi
|
||||
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
local VERSION_LIST
|
||||
VERSION_LIST="$(nvm_download -L -s "${MIRROR}/index.tab" -o - \
|
||||
| command sed "
|
||||
@@ -1171,8 +1217,7 @@ nvm_ls_remote_index_tab() {
|
||||
nvm_make_alias "$LTS_ALIAS" "$LTS_VERSION" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
VERSIONS="$(nvm_echo "${VERSION_LIST}" \
|
||||
| command awk -v pattern="${PATTERN-}" -v lts="${LTS-}" '{
|
||||
VERSIONS="$({ command awk -v pattern="${PATTERN-}" -v lts="${LTS-}" '{
|
||||
if (!$1) { next }
|
||||
if (pattern && tolower($1) !~ tolower(pattern)) { next }
|
||||
if (lts == "*" && $10 ~ /^\-?$/) { next }
|
||||
@@ -1180,10 +1225,10 @@ nvm_ls_remote_index_tab() {
|
||||
if ($10 !~ /^\-?$/) print $1, $10; else print $1
|
||||
}' \
|
||||
| nvm_grep -w "${PATTERN:-.*}" \
|
||||
| $SORT_COMMAND)"
|
||||
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
| $SORT_COMMAND; } << EOF
|
||||
$VERSION_LIST
|
||||
EOF
|
||||
)"
|
||||
if [ -z "${VERSIONS}" ]; then
|
||||
nvm_echo 'N/A'
|
||||
return 3
|
||||
@@ -1453,8 +1498,6 @@ nvm_print_implicit_alias() {
|
||||
return 2
|
||||
fi
|
||||
|
||||
local ZSH_HAS_SHWORDSPLIT_UNSET
|
||||
|
||||
local NVM_IOJS_PREFIX
|
||||
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
|
||||
local NVM_NODE_PREFIX
|
||||
@@ -1470,11 +1513,7 @@ nvm_print_implicit_alias() {
|
||||
NVM_COMMAND="nvm_ls $NVM_IMPLICIT"
|
||||
fi
|
||||
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
|
||||
local NVM_IOJS_VERSION
|
||||
local EXIT_CODE
|
||||
@@ -1484,10 +1523,6 @@ nvm_print_implicit_alias() {
|
||||
NVM_IOJS_VERSION="$(nvm_echo "$NVM_IOJS_VERSION" | command sed "s/^$NVM_IMPLICIT-//" | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq | command tail -1)"
|
||||
fi
|
||||
|
||||
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
|
||||
if [ "_$NVM_IOJS_VERSION" = "_N/A" ]; then
|
||||
nvm_echo 'N/A'
|
||||
else
|
||||
@@ -1505,17 +1540,9 @@ nvm_print_implicit_alias() {
|
||||
NVM_COMMAND="nvm_ls node"
|
||||
fi
|
||||
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
|
||||
LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq)
|
||||
|
||||
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
local MINOR
|
||||
@@ -1524,11 +1551,7 @@ nvm_print_implicit_alias() {
|
||||
local MOD
|
||||
local NORMALIZED_VERSION
|
||||
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
for MINOR in $LAST_TWO; do
|
||||
NORMALIZED_VERSION="$(nvm_normalize_version "$MINOR")"
|
||||
if [ "_0${NORMALIZED_VERSION#?}" != "_$NORMALIZED_VERSION" ]; then
|
||||
@@ -1542,14 +1565,11 @@ nvm_print_implicit_alias() {
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
|
||||
if [ "_$2" = '_stable' ]; then
|
||||
nvm_echo "${STABLE}"
|
||||
elif [ "_$2" = '_unstable' ]; then
|
||||
nvm_echo "${UNSTABLE}"
|
||||
nvm_echo "${UNSTABLE:-"N/A"}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1698,12 +1718,19 @@ nvm_install_binary() {
|
||||
local TMPDIR
|
||||
local VERSION_PATH
|
||||
|
||||
local PROGRESS_BAR
|
||||
local NODE_OR_IOJS
|
||||
if [ "${FLAVOR}" = 'node' ]; then
|
||||
NODE_OR_IOJS="${FLAVOR}"
|
||||
fi
|
||||
if [ "${NVM_NO_PROGRESS-}" = "1" ]; then
|
||||
# --silent, --show-error, use short option as @samrocketman mentions the compatibility issue.
|
||||
PROGRESS_BAR="-sS"
|
||||
else
|
||||
PROGRESS_BAR="--progress-bar"
|
||||
fi
|
||||
nvm_echo "Downloading and installing ${NODE_OR_IOJS-} ${VERSION}..."
|
||||
TARBALL="$(nvm_download_artifact "${FLAVOR}" binary "${TYPE-}" "${VERSION}" | command tail -1)"
|
||||
TARBALL="$(PROGRESS_BAR="${PROGRESS_BAR}" nvm_download_artifact "${FLAVOR}" binary "${TYPE-}" "${VERSION}" | command tail -1)"
|
||||
if [ -f "${TARBALL}" ]; then
|
||||
TMPDIR="$(dirname "${TARBALL}")/files"
|
||||
fi
|
||||
@@ -1860,7 +1887,7 @@ nvm_download_artifact() {
|
||||
command rm -rf "${TARBALL}"
|
||||
fi
|
||||
nvm_err "Downloading ${TARBALL_URL}..."
|
||||
nvm_download -L -C - --progress-bar "${TARBALL_URL}" -o "${TARBALL}" || (
|
||||
nvm_download -L -C - "${PROGRESS_BAR}" "${TARBALL_URL}" -o "${TARBALL}" || (
|
||||
command rm -rf "${TARBALL}" "${tmpdir}"
|
||||
nvm_err "Binary download from ${TARBALL_URL} failed, trying source."
|
||||
return 4
|
||||
@@ -2007,7 +2034,16 @@ nvm_install_source() {
|
||||
local TMPDIR
|
||||
local VERSION_PATH
|
||||
|
||||
TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
|
||||
if [ "${NVM_NO_PROGRESS-}" = "1" ]; then
|
||||
# --silent, --show-error, use short option as @samrocketman mentions the compatibility issue.
|
||||
PROGRESS_BAR="-sS"
|
||||
else
|
||||
PROGRESS_BAR="--progress-bar"
|
||||
fi
|
||||
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
|
||||
TARBALL="$(PROGRESS_BAR="${PROGRESS_BAR}" nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
|
||||
[ -f "${TARBALL}" ] && \
|
||||
TMPDIR="$(dirname "${TARBALL}")/files" && \
|
||||
if ! (
|
||||
@@ -2234,31 +2270,17 @@ nvm_is_natural_num() {
|
||||
|
||||
# Check version dir permissions
|
||||
nvm_check_file_permissions() {
|
||||
local ZSH_HAS_NONOMATCH_UNSET
|
||||
ZSH_HAS_NONOMATCH_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_NONOMATCH_UNSET="$(set +e ; setopt | nvm_grep -q nonomatch ; nvm_echo $?)"
|
||||
setopt nonomatch
|
||||
fi
|
||||
for FILE in $1/* $1/.[!.]* $1/..?* ; do
|
||||
nvm_is_zsh && setopt local_options nonomatch
|
||||
for FILE in "$1"/* "$1"/.[!.]* "$1"/..?* ; do
|
||||
if [ -d "$FILE" ]; then
|
||||
if ! nvm_check_file_permissions "$FILE"; then
|
||||
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
return 2
|
||||
fi
|
||||
elif [ -e "$FILE" ] && [ ! -w "$FILE" ] && [ ! -O "$FILE" ]; then
|
||||
nvm_err "file is not writable or self-owned: $(nvm_sanitize_path "$FILE")"
|
||||
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
if [ "${ZSH_HAS_NONOMATCH_UNSET}" -eq 1 ] && nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -2313,6 +2335,7 @@ nvm() {
|
||||
nvm_echo ' --lts=<LTS name> When installing, only select from versions for a specific LTS line'
|
||||
nvm_echo ' --skip-default-packages When installing, skip the default-packages file if it exists'
|
||||
nvm_echo ' --latest-npm After installing, attempt to upgrade to the latest working npm on the given node version'
|
||||
nvm_echo ' --no-progress Disable the progress bar on any downloads'
|
||||
nvm_echo ' nvm uninstall <version> Uninstall a version'
|
||||
nvm_echo ' nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.'
|
||||
nvm_echo ' nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.'
|
||||
@@ -2325,7 +2348,7 @@ nvm() {
|
||||
nvm_echo ' nvm run [--silent] <version> [<args>] Run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
|
||||
nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
|
||||
nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
|
||||
nvm_echo ' nvm current Display currently activated version'
|
||||
nvm_echo ' nvm current Display currently activated version of Node'
|
||||
nvm_echo ' nvm ls List installed versions'
|
||||
nvm_echo ' nvm ls <version> List versions matching a given <version>'
|
||||
nvm_echo ' nvm ls-remote List remote versions available for install'
|
||||
@@ -2382,13 +2405,8 @@ nvm() {
|
||||
;;
|
||||
|
||||
"debug" )
|
||||
local ZSH_HAS_SHWORDSPLIT_UNSET
|
||||
local OS_VERSION
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
nvm_err "nvm --version: v$(nvm --version)"
|
||||
if [ -n "${TERM_PROGRAM-}" ]; then
|
||||
nvm_err "\$TERM_PROGRAM: $TERM_PROGRAM"
|
||||
@@ -2442,9 +2460,6 @@ nvm() {
|
||||
NVM_DEBUG_OUTPUT="$($NVM_DEBUG_COMMAND 2>&1)"
|
||||
nvm_err "$NVM_DEBUG_COMMAND: $(nvm_sanitize_path "$NVM_DEBUG_OUTPUT")"
|
||||
done
|
||||
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
return 42
|
||||
;;
|
||||
|
||||
@@ -2464,7 +2479,9 @@ nvm() {
|
||||
fi
|
||||
|
||||
local nobinary
|
||||
local noprogress
|
||||
nobinary=0
|
||||
noprogress=0
|
||||
local LTS
|
||||
local NVM_UPGRADE_NPM
|
||||
NVM_UPGRADE_NPM=0
|
||||
@@ -2480,6 +2497,10 @@ nvm() {
|
||||
nvm_get_make_jobs "$1"
|
||||
shift # consume job count
|
||||
;;
|
||||
--no-progress)
|
||||
noprogress=1
|
||||
shift
|
||||
;;
|
||||
--lts)
|
||||
LTS='*'
|
||||
shift
|
||||
@@ -2688,7 +2709,7 @@ nvm() {
|
||||
|
||||
# skip binary install if "nobinary" option specified.
|
||||
if [ $nobinary -ne 1 ] && nvm_binary_available "$VERSION"; then
|
||||
nvm_install_binary "${FLAVOR}" std "${VERSION}"
|
||||
NVM_NO_PROGRESS="${NVM_NO_PROGRESS:-${noprogress}}" nvm_install_binary "${FLAVOR}" std "${VERSION}"
|
||||
EXIT_CODE=$?
|
||||
fi
|
||||
if [ "$EXIT_CODE" -ne 0 ]; then
|
||||
@@ -2696,7 +2717,7 @@ nvm() {
|
||||
nvm_get_make_jobs
|
||||
fi
|
||||
|
||||
nvm_install_source "${FLAVOR}" std "${VERSION}" "${NVM_MAKE_JOBS}" "${ADDITIONAL_PARAMETERS}"
|
||||
NVM_NO_PROGRESS="${NVM_NO_PROGRESS:-${noprogress}}" nvm_install_source "${FLAVOR}" std "${VERSION}" "${NVM_MAKE_JOBS}" "${ADDITIONAL_PARAMETERS}"
|
||||
EXIT_CODE=$?
|
||||
fi
|
||||
|
||||
@@ -3025,12 +3046,7 @@ nvm() {
|
||||
|
||||
local EXIT_CODE
|
||||
|
||||
local ZSH_HAS_SHWORDSPLIT_UNSET
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET=1
|
||||
if nvm_has "setopt"; then
|
||||
ZSH_HAS_SHWORDSPLIT_UNSET="$(set +e ; setopt | nvm_grep -q shwordsplit ; nvm_echo $?)"
|
||||
setopt shwordsplit
|
||||
fi
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
local LTS_ARG
|
||||
if [ -n "${NVM_LTS-}" ]; then
|
||||
LTS_ARG="--lts=${NVM_LTS-}"
|
||||
@@ -3044,9 +3060,6 @@ nvm() {
|
||||
nvm exec "${NVM_SILENT-}" "${LTS_ARG-}" "$VERSION" node "$@"
|
||||
fi
|
||||
EXIT_CODE="$?"
|
||||
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
|
||||
unsetopt shwordsplit
|
||||
fi
|
||||
return $EXIT_CODE
|
||||
;;
|
||||
"exec" )
|
||||
@@ -3408,7 +3421,7 @@ nvm() {
|
||||
esac
|
||||
shift
|
||||
done
|
||||
case "${PATTERN}" in
|
||||
case "${PATTERN-}" in
|
||||
'lts/*')
|
||||
NVM_LTS='*'
|
||||
unset PATTERN
|
||||
@@ -3421,7 +3434,7 @@ nvm() {
|
||||
NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}"
|
||||
;;
|
||||
"--version" )
|
||||
nvm_echo '0.33.9'
|
||||
nvm_echo '0.34.0'
|
||||
;;
|
||||
"unload" )
|
||||
nvm deactivate >/dev/null 2>&1
|
||||
@@ -3459,7 +3472,7 @@ nvm() {
|
||||
nvm_print_default_alias nvm_print_formatted_alias nvm_resolve_local_alias \
|
||||
nvm_sanitize_path nvm_has_colors nvm_process_parameters \
|
||||
node_version_has_solaris_binary iojs_version_has_solaris_binary \
|
||||
nvm_curl_libz_support nvm_command_info \
|
||||
nvm_curl_libz_support nvm_command_info nvm_is_zsh \
|
||||
> /dev/null 2>&1
|
||||
unset NVM_RC_VERSION NVM_NODEJS_ORG_MIRROR NVM_IOJS_ORG_MIRROR NVM_DIR \
|
||||
NVM_CD_FLAGS NVM_BIN NVM_MAKE_JOBS \
|
||||
@@ -3523,6 +3536,8 @@ nvm_supports_xz() {
|
||||
}
|
||||
|
||||
nvm_auto() {
|
||||
local NVM_CURRENT
|
||||
NVM_CURRENT="$(nvm_ls_current)"
|
||||
local NVM_MODE
|
||||
NVM_MODE="${1-}"
|
||||
local VERSION
|
||||
@@ -3534,12 +3549,16 @@ nvm_auto() {
|
||||
nvm install >/dev/null
|
||||
fi
|
||||
elif [ "_$NVM_MODE" = '_use' ]; then
|
||||
if [ "_${NVM_CURRENT}" = '_none' ] || [ "_${NVM_CURRENT}" = '_system' ]; then
|
||||
VERSION="$(nvm_resolve_local_alias default 2>/dev/null || nvm_echo)"
|
||||
if [ -n "$VERSION" ]; then
|
||||
nvm use --silent "$VERSION" >/dev/null
|
||||
if [ -n "${VERSION}" ]; then
|
||||
nvm use --silent "${VERSION}" >/dev/null
|
||||
elif nvm_rc_version >/dev/null 2>&1; then
|
||||
nvm use --silent >/dev/null
|
||||
fi
|
||||
else
|
||||
nvm use --silent "${NVM_CURRENT}" >/dev/null
|
||||
fi
|
||||
elif [ "_$NVM_MODE" != '_none' ]; then
|
||||
nvm_err 'Invalid auto mode supplied.'
|
||||
return 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvm",
|
||||
"version": "0.33.9",
|
||||
"version": "0.34.0",
|
||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
@@ -15,7 +15,8 @@
|
||||
"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",
|
||||
"doctoc": "doctoc --title='## Table of Contents' --github README.md",
|
||||
"eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)"
|
||||
"eclint": "eclint check $(git ls-tree --name-only HEAD | xargs)",
|
||||
"dockerfile_lint": "dockerfile_lint"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -35,6 +36,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/creationix/nvm",
|
||||
"devDependencies": {
|
||||
"dockerfile_lint": "^0.3.2",
|
||||
"eclint": "^2.6.0",
|
||||
"replace": "^0.3.0",
|
||||
"semver": "^5.0.1",
|
||||
|
||||
@@ -14,9 +14,9 @@ cleanup () {
|
||||
rm -rf "${NVM_DIR}/versions/io.js/v0.2.1"
|
||||
}
|
||||
|
||||
mkdir "${NVM_DIR}/v0.8.1"
|
||||
mkdir "${NVM_DIR}/v0.9.1"
|
||||
mkdir -p "${NVM_DIR}/versions/io.js/v0.2.1"
|
||||
make_fake_node v0.8.1
|
||||
make_fake_node v0.9.1
|
||||
make_fake_iojs v0.2.1
|
||||
|
||||
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
|
||||
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
for i in $(seq 1 10)
|
||||
do
|
||||
echo 0.0.$i > ../../../alias/test-stable-$i
|
||||
mkdir -p ../../../v0.0.$i
|
||||
make_fake_node v0.0.$i
|
||||
echo 0.1.$i > ../../../alias/test-unstable-$i
|
||||
mkdir -p ../../../v0.1.$i
|
||||
make_fake_node v0.1.$i
|
||||
echo 0.2.$i > ../../../alias/test-iojs-$i
|
||||
mkdir -p ../../../versions/io.js/v0.2.$i
|
||||
make_fake_iojs v0.2.$i
|
||||
done
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir -p "${NVM_DIR}/v0.0.2"
|
||||
mkdir -p "${NVM_DIR}/v0.0.20"
|
||||
mkdir -p "${NVM_DIR}/versions/node/v0.12.0"
|
||||
make_fake_node v0.0.2
|
||||
make_fake_node v0.0.20
|
||||
make_fake_node v0.12.0
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.0.2"
|
||||
mkdir "${NVM_DIR}/v0.0.20"
|
||||
make_fake_node v0.0.2
|
||||
make_fake_node v0.0.20
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.1.3"
|
||||
mkdir "${NVM_DIR}/v0.2.3"
|
||||
mkdir "${NVM_DIR}/v0.20.3"
|
||||
make_fake_node v0.1.3
|
||||
make_fake_node v0.2.3
|
||||
make_fake_node v0.20.3
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
mkdir "${NVM_DIR}/v0.2.3"
|
||||
mkdir "${NVM_DIR}/v0.3.3"
|
||||
make_fake_node v0.2.3
|
||||
make_fake_node v0.3.3
|
||||
|
||||
EXPECTED_STABLE="$(nvm_print_implicit_alias local stable)"
|
||||
STABLE_VERSION="$(nvm_version "$EXPECTED_STABLE")"
|
||||
@@ -19,10 +20,10 @@ nvm ls stable | \grep "$STABLE_VERSION" >/dev/null \
|
||||
nvm ls unstable | \grep "$UNSTABLE_VERSION" >/dev/null \
|
||||
|| die "expected 'nvm ls unstable' to give $UNSTABLE_VERSION, got $(nvm ls unstable)"
|
||||
|
||||
mkdir "${NVM_DIR}/v0.1.2"
|
||||
make_fake_node v0.1.4
|
||||
nvm alias stable 0.1
|
||||
|
||||
nvm ls stable | \grep -v "$STABLE_VERSION" >/dev/null \
|
||||
|| die "'nvm ls stable' contained $STABLE_VERSION instead of v0.1.2"
|
||||
nvm ls stable | \grep v0.1.2 >/dev/null \
|
||||
|| die "'nvm ls stable' did not contain v0.1.2"
|
||||
|| die "'nvm ls stable' contained $STABLE_VERSION instead of v0.1.4"
|
||||
nvm ls stable | \grep v0.1.4 >/dev/null \
|
||||
|| die "'nvm ls stable' did not contain v0.1.4"
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir -p "${NVM_DIR}/v0.0.1"
|
||||
mkdir -p "${NVM_DIR}/v0.0.3"
|
||||
mkdir -p "${NVM_DIR}/v0.0.9"
|
||||
mkdir -p "${NVM_DIR}/v0.3.1"
|
||||
mkdir -p "${NVM_DIR}/v0.3.3"
|
||||
mkdir -p "${NVM_DIR}/v0.3.9"
|
||||
make_fake_node v0.0.1
|
||||
make_fake_node v0.0.3
|
||||
make_fake_node v0.0.9
|
||||
make_fake_node v0.3.1
|
||||
make_fake_node v0.3.3
|
||||
make_fake_node v0.3.9
|
||||
|
||||
nvm_has_system_node() { return 0; }
|
||||
nvm ls system | grep system 2>&1 > /dev/null
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.0.1"
|
||||
mkdir "${NVM_DIR}/v0.0.3"
|
||||
mkdir "${NVM_DIR}/v0.0.9"
|
||||
mkdir "${NVM_DIR}/v0.3.1"
|
||||
mkdir "${NVM_DIR}/v0.3.3"
|
||||
mkdir "${NVM_DIR}/v0.3.9"
|
||||
mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
|
||||
mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
|
||||
mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
|
||||
mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
make_fake_node v0.0.1
|
||||
make_fake_node v0.0.3
|
||||
make_fake_node v0.0.9
|
||||
make_fake_node v0.3.1
|
||||
make_fake_node v0.3.3
|
||||
make_fake_node v0.3.9
|
||||
make_fake_node v0.12.87
|
||||
make_fake_node v0.12.9
|
||||
make_fake_iojs v0.1.2
|
||||
make_fake_iojs v0.10.2
|
||||
|
||||
# The result should contain the version numbers.
|
||||
nvm ls | grep v0.0.1 >/dev/null &&
|
||||
nvm ls | grep v0.0.3 >/dev/null &&
|
||||
nvm ls | grep v0.0.9 >/dev/null &&
|
||||
nvm ls | grep v0.3.1 >/dev/null &&
|
||||
nvm ls | grep v0.3.3 >/dev/null &&
|
||||
nvm ls | grep v0.3.9 >/dev/null &&
|
||||
nvm ls | grep v0.12.87 >/dev/null &&
|
||||
nvm ls | grep iojs-v0.1.2 >/dev/null
|
||||
nvm ls | grep v0.0.1 >/dev/null || die "v0.0.1 not found in: $(nvm ls)"
|
||||
nvm ls | grep v0.0.3 >/dev/null || die "v0.0.3 not found in: $(nvm ls)"
|
||||
nvm ls | grep v0.0.9 >/dev/null || die "v0.0.9 not found in: $(nvm ls)"
|
||||
nvm ls | grep v0.3.1 >/dev/null || die "v0.3.1 not found in: $(nvm ls)"
|
||||
nvm ls | grep v0.3.3 >/dev/null || die "v0.3.3 not found in: $(nvm ls)"
|
||||
nvm ls | grep v0.3.9 >/dev/null || die "v0.3.9 not found in: $(nvm ls)"
|
||||
nvm ls | grep v0.12.87 >/dev/null || die "v0.12.87 not found in: $(nvm ls)"
|
||||
nvm ls | grep iojs-v0.1.2 >/dev/null || die "iojs-v0.1.2 not found in: $(nvm ls)"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.1.3"
|
||||
mkdir "${NVM_DIR}/v0.2.3"
|
||||
make_fake_node v0.1.3
|
||||
make_fake_node v0.2.3
|
||||
|
||||
[ -z `nvm ls | grep '^ *\.'` ]
|
||||
# The result should contain only the appropriate version numbers.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.1.3"
|
||||
mkdir "${NVM_DIR}/v0.2.3"
|
||||
mkdir -p "${NVM_DIR}/versions/node"
|
||||
make_fake_node v0.1.3
|
||||
make_fake_node v0.2.3
|
||||
|
||||
[ -z "$(nvm ls | \grep 'versions')" ]
|
||||
# The result should contain only the appropriate version numbers.
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir -p "${NVM_DIR}/v0.0.1"
|
||||
mkdir -p "${NVM_DIR}/v0.0.3"
|
||||
mkdir -p "${NVM_DIR}/v0.0.9"
|
||||
mkdir -p "${NVM_DIR}/v0.3.1"
|
||||
mkdir -p "${NVM_DIR}/v0.3.3"
|
||||
mkdir -p "${NVM_DIR}/v0.3.9"
|
||||
make_fake_node v0.0.1
|
||||
make_fake_node v0.0.3
|
||||
make_fake_node v0.0.9
|
||||
make_fake_node v0.3.1
|
||||
make_fake_node v0.3.3
|
||||
make_fake_node v0.3.9
|
||||
|
||||
nvm_has_system_node() { return 0; }
|
||||
nvm ls | grep system 2>&1 > /dev/null
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir -p "${NVM_DIR}/versions/node/v0.12.1"
|
||||
mkdir "${NVM_DIR}/v0.1.3"
|
||||
make_fake_node v0.12.1
|
||||
make_fake_node v0.1.3
|
||||
|
||||
nvm ls 0.12 | grep v0.12.1 || die '"nvm ls" did not list a version in the versions/ directory'
|
||||
nvm ls 0.1 | grep v0.1.3 || die '"nvm ls" did not list a version not in the versions/ directory'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.1.2"
|
||||
make_fake_node v0.1.2
|
||||
|
||||
nvm ls v0.1 | grep v0.1.2 &&
|
||||
nvm ls v0.1.2 | grep v0.1.2 &&
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.0.1"
|
||||
mkdir "${NVM_DIR}/v0.0.3"
|
||||
mkdir "${NVM_DIR}/v0.0.9"
|
||||
mkdir "${NVM_DIR}/v0.3.1"
|
||||
mkdir "${NVM_DIR}/v0.3.3"
|
||||
mkdir "${NVM_DIR}/v0.3.9"
|
||||
mkdir -p "${NVM_DIR}/versions/node/v0.12.87"
|
||||
mkdir -p "${NVM_DIR}/versions/node/v0.12.9"
|
||||
mkdir -p "${NVM_DIR}/versions/io.js/v0.1.2"
|
||||
mkdir -p "${NVM_DIR}/versions/io.js/v0.10.2"
|
||||
make_fake_node v0.0.1
|
||||
make_fake_node v0.0.3
|
||||
make_fake_node v0.0.9
|
||||
make_fake_node v0.3.1
|
||||
make_fake_node v0.3.3
|
||||
make_fake_node v0.3.9
|
||||
make_fake_node v0.12.87
|
||||
make_fake_node v0.12.9
|
||||
make_fake_iojs v0.1.2
|
||||
make_fake_iojs v0.10.2
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ rmdir ../../../v0.0.9 >/dev/null 2>&1
|
||||
rmdir ../../../v0.0.20 >/dev/null 2>&1
|
||||
rmdir ../../../v0.1.2 >/dev/null 2>&1
|
||||
rmdir ../../../v0.1.3 >/dev/null 2>&1
|
||||
rmdir ../../../v0.1.4 >/dev/null 2>&1
|
||||
rmdir ../../../v0.2.3 >/dev/null 2>&1
|
||||
rmdir ../../../v0.3.1 >/dev/null 2>&1
|
||||
rmdir ../../../v0.3.3 >/dev/null 2>&1
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
set -ex
|
||||
|
||||
mkdir -p ../../v0.2.3
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
[ `expr $PATH : ".*v0.2.3/.*/bin.*"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
|
||||
|
||||
\. ../../nvm.sh
|
||||
\. ../common.sh
|
||||
|
||||
make_fake_node v0.2.3
|
||||
|
||||
[ `expr $PATH : ".*v0.2.3/.*/bin.*"` = 0 ] || echo "WARNING: Unexpectedly found v0.2.3 already active" >&2
|
||||
|
||||
nvm use --delete-prefix v0.2.3 || die "Failed to activate v0.2.3"
|
||||
[ `expr "$PATH" : ".*v0.2.3/.*/bin.*"` != 0 ] || die "PATH not set up properly"
|
||||
|
||||
@@ -8,8 +8,9 @@ cleanup () {
|
||||
}
|
||||
|
||||
\. ../../nvm.sh
|
||||
\. ../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.10.4"
|
||||
make_fake_node v0.10.4
|
||||
|
||||
nvm deactivate >/dev/null 2>&1
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
set -ex
|
||||
|
||||
cd ../..
|
||||
mkdir v0.0.1
|
||||
mkdir src/node-v0.0.1
|
||||
\. ../../nvm.sh
|
||||
\. ../common.sh
|
||||
|
||||
make_fake_node v0.0.1
|
||||
|
||||
. ./nvm.sh
|
||||
nvm uninstall v0.0.1
|
||||
|
||||
[ ! -d 'v0.0.1' ] && [ ! -d 'src/node-v0.0.1/files' ]
|
||||
[ ! -d 'v0.0.1' ]
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
|
||||
set -ex
|
||||
|
||||
cd ../..
|
||||
mkdir v0.0.1
|
||||
mkdir src/node-v0.0.1
|
||||
\. ../../nvm.sh
|
||||
\. ../common.sh
|
||||
|
||||
sudo touch v0.0.1/sudo
|
||||
|
||||
. ./nvm.sh
|
||||
make_fake_node v0.0.1
|
||||
sudo touch ""$(nvm_version_path v0.0.1)"/sudo"
|
||||
|
||||
RETURN_MESSAGE="$(nvm uninstall v0.0.1 2>&1 || echo)"
|
||||
CHECK_FOR="Cannot uninstall, incorrect permissions on installation folder"
|
||||
|
||||
@@ -4,11 +4,12 @@ set -ex
|
||||
|
||||
export NVM_SYMLINK_CURRENT=true
|
||||
\. ../../nvm.sh
|
||||
\. ../common.sh
|
||||
|
||||
rm -rf "${NVM_DIR}/v0.10.29"
|
||||
mkdir "${NVM_DIR}/v0.10.29"
|
||||
make_fake_node v0.10.29
|
||||
nvm use --delete-prefix 0.10.29
|
||||
rmdir "${NVM_DIR}/v0.10.29"
|
||||
rm -rf "${NVM_DIR}/v0.10.29"
|
||||
|
||||
if [ ! -L "${NVM_DIR}/current" ];then
|
||||
echo "Expected 'current' symlink to be created!"
|
||||
@@ -23,9 +24,9 @@ if [ "$(basename "${oldLink}")" != 'v0.10.29' ];then
|
||||
fi
|
||||
|
||||
rm -rf "${NVM_DIR}/v0.11.13"
|
||||
mkdir "${NVM_DIR}/v0.11.13"
|
||||
make_fake_node v0.11.13
|
||||
nvm use --delete-prefix 0.11.13
|
||||
rmdir "${NVM_DIR}/v0.11.13"
|
||||
rm -rf "${NVM_DIR}/v0.11.13"
|
||||
|
||||
newLink="$(readlink "${NVM_DIR}/current")"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
set -ex
|
||||
|
||||
\. ../../nvm.sh
|
||||
\. ../common.sh
|
||||
|
||||
TEST_NODE_VERSION="v0.10.29"
|
||||
|
||||
@@ -35,9 +36,9 @@ cleanup() {
|
||||
}
|
||||
|
||||
runNvmUse() {
|
||||
mkdir "${NVM_DIR}/${TEST_NODE_VERSION}"
|
||||
make_fake_node "$TEST_NODE_VERSION"
|
||||
nvm use --delete-prefix "${TEST_NODE_VERSION}" > /dev/null 2>&1
|
||||
rmdir "${NVM_DIR}/${TEST_NODE_VERSION}"
|
||||
rm -rf "${NVM_DIR}/${TEST_NODE_VERSION}"
|
||||
}
|
||||
|
||||
isCurrentSymlinkPresent() {
|
||||
|
||||
33
test/fast/Running "nvm use" should drop CR char automatically.
Executable file
33
test/fast/Running "nvm use" should drop CR char automatically.
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
unset VERSION1 VERSION2 VERSION3
|
||||
rm .nvmrc
|
||||
}
|
||||
|
||||
\. ../../nvm.sh
|
||||
|
||||
# normal .nvmrc
|
||||
printf '0.999.0\n' > .nvmrc
|
||||
nvm_rc_version
|
||||
VERSION1="${NVM_RC_VERSION}"
|
||||
|
||||
# .nvmrc with CR char
|
||||
printf '0.999.0\r\n' > .nvmrc
|
||||
nvm_rc_version
|
||||
VERSION2="${NVM_RC_VERSION}"
|
||||
|
||||
[ "${VERSION1}" = "${VERSION2}" ]
|
||||
|
||||
# .nvmrc without any newline char
|
||||
printf '0.999.0' > .nvmrc
|
||||
nvm_rc_version
|
||||
VERSION3="${NVM_RC_VERSION}"
|
||||
|
||||
[ "${VERSION1}" = "${VERSION3}" ]
|
||||
|
||||
cleanup
|
||||
@@ -1,4 +1,7 @@
|
||||
version date files npm v8 uv zlib openssl modules lts
|
||||
v10.2.0 2018-05-23 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,osx-x64-pkg,osx-x64-tar,src,sunos-x64,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.6.346.32 1.20.3 1.2.11 1.1.0h 64 -
|
||||
v10.1.0 2018-05-08 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,osx-x64-pkg,osx-x64-tar,src,sunos-x64,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.6.346.27 1.20.2 1.2.11 1.1.0h 64 -
|
||||
v10.0.0 2018-04-24 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,osx-x64-pkg,osx-x64-tar,src,sunos-x64,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.6.346.24 1.20.2 1.2.11 1.1.0h 64 -
|
||||
v9.11.1 2018-04-05 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.46 1.19.2 1.2.11 1.0.2o 59 -
|
||||
v9.11.0 2018-04-04 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.46 1.19.2 1.2.11 1.0.2o 59 -
|
||||
v9.10.1 2018-03-29 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.46 1.19.2 1.2.11 1.0.2o 59 -
|
||||
@@ -16,6 +19,7 @@ v9.2.1 2017-12-08 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-
|
||||
v9.2.0 2017-11-14 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.5.1 6.2.414.44 1.16.1 1.2.11 1.0.2m 59 -
|
||||
v9.1.0 2017-11-07 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.5.1 6.2.414.32 1.15.0 1.2.11 1.0.2m 59 -
|
||||
v9.0.0 2017-10-31 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.5.1 6.2.414.32 1.15.0 1.2.11 1.0.2l 59 -
|
||||
v8.11.2 2018-05-15 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.54 1.19.1 1.2.11 1.0.2o 57 Carbon
|
||||
v8.11.1 2018-03-29 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.50 1.19.1 1.2.11 1.0.2o 57 Carbon
|
||||
v8.11.0 2018-03-28 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.50 1.19.1 1.2.11 1.0.2o 57 Carbon
|
||||
v8.10.0 2018-03-06 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 5.6.0 6.2.414.50 1.19.1 1.2.11 1.0.2n 57 Carbon
|
||||
@@ -56,6 +60,7 @@ v7.2.1 2016-12-06 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-
|
||||
v7.2.0 2016-11-22 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.9 5.4.500.43 1.10.1 1.2.8 1.0.2j 51 -
|
||||
v7.1.0 2016-11-08 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.9 5.4.500.36 1.10.0 1.2.8 1.0.2j 51 -
|
||||
v7.0.0 2016-10-25 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.8 5.4.500.36 1.9.1 1.2.8 1.0.2j 51 -
|
||||
v6.14.2 2018-04-30 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.10 5.1.281.111 1.16.1 1.2.11 1.0.2o 48 Boron
|
||||
v6.14.1 2018-03-29 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.10 5.1.281.111 1.16.1 1.2.11 1.0.2o 48 Boron
|
||||
v6.14.0 2018-03-28 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.10 5.1.281.111 1.16.1 1.2.11 1.0.2o 48 Boron
|
||||
v6.13.1 2018-03-06 aix-ppc64,headers,linux-arm64,linux-armv6l,linux-armv7l,linux-ppc64le,linux-x64,linux-x86,osx-x64-pkg,osx-x64-tar,src,sunos-x64,sunos-x86,win-x64-7z,win-x64-exe,win-x64-msi,win-x64-zip,win-x86-7z,win-x86-exe,win-x86-msi,win-x86-zip 3.10.10 5.1.281.111 1.16.1 1.2.11 1.0.2n 48 Boron
|
||||
|
||||
1084
test/fast/Unit tests/mocks/nodejs.org-download-nightly-index.tab
Normal file
1084
test/fast/Unit tests/mocks/nodejs.org-download-nightly-index.tab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,8 @@
|
||||
v6.13.0 [0;37m (LTS: Boron)[0m
|
||||
v6.13.1 [0;37m (LTS: Boron)[0m
|
||||
v6.14.0 [0;37m (LTS: Boron)[0m
|
||||
v6.14.1 [1;32m (Latest LTS: Boron)[0m
|
||||
v6.14.1 [0;37m (LTS: Boron)[0m
|
||||
v6.14.2 [1;32m (Latest LTS: Boron)[0m
|
||||
v8.9.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.9.1 [0;37m (LTS: Carbon)[0m
|
||||
v8.9.2 [0;37m (LTS: Carbon)[0m
|
||||
@@ -65,4 +66,5 @@
|
||||
v8.9.4 [0;37m (LTS: Carbon)[0m
|
||||
v8.10.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.1 [1;32m (Latest LTS: Carbon)[0m
|
||||
v8.11.1 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.2 [1;32m (Latest LTS: Carbon)[0m
|
||||
|
||||
@@ -330,7 +330,8 @@
|
||||
v6.13.0 [0;37m (LTS: Boron)[0m
|
||||
v6.13.1 [0;37m (LTS: Boron)[0m
|
||||
v6.14.0 [0;37m (LTS: Boron)[0m
|
||||
v6.14.1 [1;32m (Latest LTS: Boron)[0m
|
||||
v6.14.1 [0;37m (LTS: Boron)[0m
|
||||
v6.14.2 [1;32m (Latest LTS: Boron)[0m
|
||||
v7.0.0
|
||||
v7.1.0
|
||||
v7.2.0
|
||||
@@ -370,7 +371,8 @@
|
||||
v8.9.4 [0;37m (LTS: Carbon)[0m
|
||||
v8.10.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.1 [1;32m (Latest LTS: Carbon)[0m
|
||||
v8.11.1 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.2 [1;32m (Latest LTS: Carbon)[0m
|
||||
v9.0.0
|
||||
v9.1.0
|
||||
v9.2.0
|
||||
@@ -388,3 +390,6 @@
|
||||
v9.10.1
|
||||
v9.11.0
|
||||
v9.11.1
|
||||
v10.0.0
|
||||
v10.1.0
|
||||
v10.2.0
|
||||
|
||||
@@ -371,7 +371,8 @@
|
||||
v6.13.0 [0;37m (LTS: Boron)[0m
|
||||
v6.13.1 [0;37m (LTS: Boron)[0m
|
||||
v6.14.0 [0;37m (LTS: Boron)[0m
|
||||
v6.14.1 [1;32m (Latest LTS: Boron)[0m
|
||||
v6.14.1 [0;37m (LTS: Boron)[0m
|
||||
v6.14.2 [1;32m (Latest LTS: Boron)[0m
|
||||
v7.0.0
|
||||
v7.1.0
|
||||
v7.2.0
|
||||
@@ -411,7 +412,8 @@
|
||||
v8.9.4 [0;37m (LTS: Carbon)[0m
|
||||
v8.10.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.0 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.1 [1;32m (Latest LTS: Carbon)[0m
|
||||
v8.11.1 [0;37m (LTS: Carbon)[0m
|
||||
v8.11.2 [1;32m (Latest LTS: Carbon)[0m
|
||||
v9.0.0
|
||||
v9.1.0
|
||||
v9.2.0
|
||||
@@ -429,3 +431,6 @@
|
||||
v9.10.1
|
||||
v9.11.0
|
||||
v9.11.1
|
||||
v10.0.0
|
||||
v10.1.0
|
||||
v10.2.0
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
N/A
|
||||
12
test/fast/Unit tests/mocks/nvm_ls_remote LTS nightly.txt
Normal file
12
test/fast/Unit tests/mocks/nvm_ls_remote LTS nightly.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
v6.9.1-nightly201610183843b96e46 Boron
|
||||
v6.9.2-nightly201610208bb346d61a Boron
|
||||
v6.9.3-nightly20161206c350268432 Boron
|
||||
v6.9.4-nightly201701049844692719 Boron
|
||||
v6.9.5-nightly2017013187ac44974a Boron
|
||||
v6.9.6-nightly201702013f61aae59d Boron
|
||||
v6.10.1-nightly20170222ee10f21f3b Boron
|
||||
v6.10.2-nightly20170322426968ddd8 Boron
|
||||
v6.10.3-nightly2017040479546c0b5a Boron
|
||||
v6.10.4-nightly20170502312091a196 Boron
|
||||
v6.11.1-nightly20170607f7ca483d68 Boron
|
||||
v8.9.1-nightly20171104a815e1b6a2 Carbon
|
||||
@@ -58,6 +58,7 @@ v6.13.0 Boron
|
||||
v6.13.1 Boron
|
||||
v6.14.0 Boron
|
||||
v6.14.1 Boron
|
||||
v6.14.2 Boron
|
||||
v8.9.0 Carbon
|
||||
v8.9.1 Carbon
|
||||
v8.9.2 Carbon
|
||||
@@ -66,3 +67,4 @@ v8.9.4 Carbon
|
||||
v8.10.0 Carbon
|
||||
v8.11.0 Carbon
|
||||
v8.11.1 Carbon
|
||||
v8.11.2 Carbon
|
||||
|
||||
95
test/fast/Unit tests/mocks/nvm_ls_remote nightly.txt
Normal file
95
test/fast/Unit tests/mocks/nvm_ls_remote nightly.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
v0.10.41-nightly20151203036580393d
|
||||
v0.10.42-nightly20160128b125512a5c
|
||||
v0.12.10-nightly20160128a305339f66
|
||||
v4.0.0-nightly201509079cae65c510
|
||||
v5.0.0-nightly201510266a04cc0a43
|
||||
v5.0.1-nightly2015111484bb74547d
|
||||
v5.1.2-nightly201512091c1c1a0f2b
|
||||
v5.2.1-nightly20151210cb938aaa33
|
||||
v5.3.1-nightly20151224b4c51c5b76
|
||||
v5.4.1-nightly20160107138e1e501e
|
||||
v5.4.2-nightly20160121e855b596f4
|
||||
v5.5.1-nightly20160127a8c2050c2d
|
||||
v5.6.1-nightly201602106d8eba0e5e
|
||||
v5.7.1-nightly20160302c83725c604
|
||||
v5.7.2-nightly2016030801c331ea37
|
||||
v5.10.2-nightly201604206d9c0c9aa7
|
||||
v5.11.1-nightly20160504bec5d50f1e
|
||||
v5.11.2-nightly2016062103d36aea4f
|
||||
v6.0.0-nightly20160425eb4201f07a
|
||||
v6.3.1-nightly201607209e9d499b8b
|
||||
v6.3.2-nightly20160815da9bd2fc48
|
||||
v6.4.1-nightly20160825723fa9637c
|
||||
v6.5.1-nightly20160914180867d6a6
|
||||
v6.6.1-nightly20160927f8ad0dc0e2
|
||||
v6.7.1-nightly20161007d7454e7547
|
||||
v6.8.1-nightly201610132540417ef5
|
||||
v6.8.2-nightly201610154613c22b00
|
||||
v6.9.1-nightly201610183843b96e46 Boron
|
||||
v6.9.2-nightly201610208bb346d61a Boron
|
||||
v6.9.3-nightly20161206c350268432 Boron
|
||||
v6.9.4-nightly201701049844692719 Boron
|
||||
v6.9.5-nightly2017013187ac44974a Boron
|
||||
v6.9.6-nightly201702013f61aae59d Boron
|
||||
v6.10.1-nightly20170222ee10f21f3b Boron
|
||||
v6.10.2-nightly20170322426968ddd8 Boron
|
||||
v6.10.3-nightly2017040479546c0b5a Boron
|
||||
v6.10.4-nightly20170502312091a196 Boron
|
||||
v6.11.1-nightly20170607f7ca483d68 Boron
|
||||
v7.0.0-nightly201610246bbdd668bd
|
||||
v7.0.1-nightly2016102527e1749dcb
|
||||
v7.1.1-nightly201611093daf11635d
|
||||
v7.2.0-nightly20161123c1aa949064
|
||||
v7.2.1-nightly201611248cabe28efb
|
||||
v7.2.2-nightly20161207c2cc11b3c6
|
||||
v7.3.1-nightly20161221586967a078
|
||||
v7.4.1-nightly20170104e07b6516d7
|
||||
v7.5.1-nightly2017020113a024d531
|
||||
v7.6.1-nightly201702227a6367017c
|
||||
v7.7.1-nightly201703019c75f4c78a
|
||||
v7.7.2-nightly20170302b20bc130ef
|
||||
v7.7.3-nightly20170309c62798034a
|
||||
v7.7.4-nightly20170315753adee6aa
|
||||
v7.7.5-nightly20170322bc664cb034
|
||||
v7.8.1-nightly20170329517f13b607
|
||||
v7.9.1-nightly20170411675ece47b3
|
||||
v7.10.1-nightly2017050369a8053e8a
|
||||
v8.0.0-nightly20170530effeff1843
|
||||
v8.1.0-nightly20170612f6fc46e036
|
||||
v8.1.1-nightly2017061323318c7661
|
||||
v8.1.2-nightly20170614a1b27dbfb4
|
||||
v8.1.3-nightly201706220b96a2640b
|
||||
v8.1.4-nightly20170704c2c7eb1a41
|
||||
v8.1.5-nightly20170718e9491f1cd4
|
||||
v8.2.1-nightly2017080791b7843aeb
|
||||
v8.3.1-nightly201708182d8d355a5f
|
||||
v8.4.1-nightly201709104b28e0055e
|
||||
v8.5.1-nightly20170921535f8d5281
|
||||
v8.6.1-nightly201710116f42b680e3
|
||||
v8.7.1-nightly2017102478a6ef46a9
|
||||
v8.8.1-nightly201710256fbef7f350
|
||||
v8.8.2-nightly20171030f00ba6b142
|
||||
v8.9.1-nightly20171104a815e1b6a2 Carbon
|
||||
v9.0.0-nightly2017103182790d84f2
|
||||
v9.0.1-nightly20171105ed0fbd8d72
|
||||
v9.1.1-nightly20171207c81e9682c4
|
||||
v9.2.1-nightly20171208f0f9e1abf0
|
||||
v9.2.2-nightly20171212f8143214be
|
||||
v9.3.1-nightly2018010930273d400c
|
||||
v9.4.1-nightly20180124dd56bd1591
|
||||
v9.5.1-nightly20180221b9b58100e0
|
||||
v9.6.1-nightly20180222927c1b1a7e
|
||||
v9.6.2-nightly201802277853a7fd2a
|
||||
v9.7.1-nightly201803013f3995b7b7
|
||||
v9.7.2-nightly20180307cde6671b41
|
||||
v9.8.1-nightly20180320607b33cfcc
|
||||
v9.9.1-nightly201803256591d9f761
|
||||
v9.10.0-nightly201803270a18bf1304
|
||||
v9.10.1-nightly201803284844a263ce
|
||||
v9.10.2-nightly201804042bdf3ca235
|
||||
v9.11.2-nightly201804135d9a7f81ae
|
||||
v10.0.0-nightly20180424982adb5994
|
||||
v10.0.1-nightly20180505ff148b987d
|
||||
v10.1.1-nightly20180523235a272838
|
||||
v10.2.1-nightly20180524be71c5dea9
|
||||
v11.0.0-nightly201805249a02de7084
|
||||
@@ -0,0 +1 @@
|
||||
v11.0.0-nightly201805249a02de7084
|
||||
@@ -1 +1 @@
|
||||
v9.11.1
|
||||
v10.2.0
|
||||
|
||||
@@ -331,6 +331,7 @@ v6.13.0 Boron
|
||||
v6.13.1 Boron
|
||||
v6.14.0 Boron
|
||||
v6.14.1 Boron
|
||||
v6.14.2 Boron
|
||||
v7.0.0
|
||||
v7.1.0
|
||||
v7.2.0
|
||||
@@ -371,6 +372,7 @@ v8.9.4 Carbon
|
||||
v8.10.0 Carbon
|
||||
v8.11.0 Carbon
|
||||
v8.11.1 Carbon
|
||||
v8.11.2 Carbon
|
||||
v9.0.0
|
||||
v9.1.0
|
||||
v9.2.0
|
||||
@@ -388,3 +390,6 @@ v9.10.0
|
||||
v9.10.1
|
||||
v9.11.0
|
||||
v9.11.1
|
||||
v10.0.0
|
||||
v10.1.0
|
||||
v10.2.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
lts/*|lts/carbon
|
||||
lts/carbon|v8.11.1
|
||||
lts/boron|v6.14.1
|
||||
lts/carbon|v8.11.2
|
||||
lts/boron|v6.14.2
|
||||
lts/argon|v4.9.1
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
11.0
|
||||
@@ -1 +1 @@
|
||||
9.11
|
||||
10.2
|
||||
|
||||
@@ -41,3 +41,17 @@ NEW_PATH=`nvm_change_path "$EMPTY_PATH" "/bin" "$NVM_DIR/versions/node/v7.1.0"`
|
||||
NEW_PATH=`nvm_change_path "$EMPTY_PATH" "/bin" "$NVM_DIR/v0.1.2"`
|
||||
|
||||
[ "$NEW_PATH" = "$NVM_DIR/v0.1.2/bin" ] || die "Not correctly prepended: $NEW_PATH "
|
||||
|
||||
|
||||
# https://github.com/creationix/nvm/issues/1652#issuecomment-342571223
|
||||
MAC_OS_NESTED_SESSION_PATH=/usr/bin:/usr/local/bin:$NVM_DIR/versions/node/v4.5.0/bin
|
||||
|
||||
# New version dir
|
||||
NEW_PATH=`nvm_change_path "$MAC_OS_NESTED_SESSION_PATH" "/bin" "$NVM_DIR/versions/node/v7.1.0"`
|
||||
|
||||
[ "$NEW_PATH" = "$NVM_DIR/versions/node/v7.1.0/bin:/usr/bin:/usr/local/bin:$NVM_DIR/versions/node/v4.5.0/bin" ] || die "Not correctly changed: $NEW_PATH "
|
||||
|
||||
# Old version dir
|
||||
NEW_PATH=`nvm_change_path "$MAC_OS_NESTED_SESSION_PATH" "/bin" "$NVM_DIR/v0.1.2"`
|
||||
|
||||
[ "$NEW_PATH" = "$NVM_DIR/v0.1.2/bin:/usr/bin:/usr/local/bin:$NVM_DIR/versions/node/v4.5.0/bin" ] || die "Not correctly changed: $NEW_PATH "
|
||||
|
||||
@@ -19,8 +19,14 @@ WGET_EXPECTED_INFO="$(which wget)"
|
||||
cleanup
|
||||
|
||||
# 2. test aliased wget
|
||||
shopt -s expand_aliases
|
||||
# enable expand_aliases to make alias working in interactive shell
|
||||
|
||||
# enable expand_aliases/aliases to make alias work in interactive shell
|
||||
if nvm_has shopt; then
|
||||
shopt -s expand_aliases
|
||||
elif nvm_has setopt; then
|
||||
setopt aliases
|
||||
fi
|
||||
|
||||
alias wget="wget -V"
|
||||
WGET_COMMAND_INFO="$(nvm_command_info wget)"
|
||||
WGET_EXPECTED_INFO="$(which wget) (wget -V)"
|
||||
@@ -38,3 +44,11 @@ WGET_EXPECTED_INFO="$(type wget)"
|
||||
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 3), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'"
|
||||
|
||||
cleanup
|
||||
|
||||
# 4. nvm_command_info() should not have standard error
|
||||
nvm_command_info ls 2>&1 >/dev/null | grep . && die "\`nvm_command_info ls\` should not return standard error message(stage 4)"
|
||||
nvm_command_info rm 2>&1 >/dev/null | grep . && die "\`nvm_command_info rm\` should not return standard error message(stage 4)"
|
||||
nvm_command_info git 2>&1 >/dev/null | grep . && die "\`nvm_command_info git\` should not return standard error message(stage 4)"
|
||||
nvm_command_info grep 2>&1 >/dev/null | grep . && die "\`nvm_command_info grep\` should not return standard error message(stage 4)"
|
||||
|
||||
cleanup
|
||||
|
||||
@@ -7,8 +7,9 @@ cleanup () {
|
||||
}
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir -p "$(nvm_version_path v0.1.2)"
|
||||
make_fake_node v0.1.2
|
||||
|
||||
OUTPUT="$(nvm_ensure_version_installed foo 2>&1)"
|
||||
EXIT_CODE=$?
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
cleanup () {
|
||||
rm "${NVM_DIR}/versions/io.js/v0.1.2/node"
|
||||
rm "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
|
||||
rmdir "${NVM_DIR}/versions/io.js/v0.1.2"
|
||||
rm -rf "${NVM_DIR}/versions/io.js/v0.1.2"
|
||||
}
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/versions/io.js/v0.1.2"
|
||||
touch "${NVM_DIR}/versions/io.js/v0.1.2/node"
|
||||
touch "${NVM_DIR}/versions/io.js/v0.1.2/iojs"
|
||||
make_fake_iojs v0.1.2
|
||||
|
||||
nvm use iojs-v0.1.2
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
cleanup () {
|
||||
rm -rf "${NVM_DIR}/v0.1.2/node"
|
||||
rm -rf "${NVM_DIR}/v0.1.2"
|
||||
}
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
mkdir "${NVM_DIR}/v0.1.2"
|
||||
touch "${NVM_DIR}/v0.1.2/node"
|
||||
make_fake_node v0.1.2
|
||||
|
||||
nvm use 0.1.2
|
||||
|
||||
|
||||
43
test/fast/Unit tests/nvm_install_no_progress_bar
Normal file
43
test/fast/Unit tests/nvm_install_no_progress_bar
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cleanup () {
|
||||
nvm cache clear
|
||||
nvm deactivate
|
||||
rm -rf ${NVM_DIR}/v*
|
||||
nvm unalias default
|
||||
}
|
||||
|
||||
die () { >&2 echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
nvm_has_colors() { return 1 ; }
|
||||
|
||||
cleanup
|
||||
|
||||
OUTPUT="$(2>&1 nvm install --no-progress v0.12.18)"
|
||||
EXPECTED_OUTPUT="Downloading and installing node v0.12.18...
|
||||
Downloading https://nodejs.org/dist/v0.12.18/node-v0.12.18-linux-x64.tar.xz...
|
||||
Computing checksum with sha256sum
|
||||
Checksums matched!
|
||||
Now using node v0.12.18 (npm v2.15.11)
|
||||
Creating default alias: default -> v0.12.18 *"
|
||||
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"
|
||||
|
||||
cleanup
|
||||
|
||||
OUTPUT="$(2>&1 nvm install v0.12.18)"
|
||||
EXPECTED_OUTPUT="Downloading and installing node v0.12.18...
|
||||
Downloading https://nodejs.org/dist/v0.12.18/node-v0.12.18-linux-x64.tar.xz...
|
||||
######################################################################## 100.0%
|
||||
Computing checksum with sha256sum
|
||||
Checksums matched!
|
||||
Now using node v0.12.18 (npm v2.15.11)
|
||||
Creating default alias: default -> v0.12.18 *"
|
||||
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"
|
||||
|
||||
cleanup
|
||||
65
test/fast/Unit tests/nvm_ls_remote nightly
Executable file
65
test/fast/Unit tests/nvm_ls_remote nightly
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
unset -f nvm_download
|
||||
}
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
MOCKS_DIR="$PWD/mocks"
|
||||
|
||||
# sample output at the time the test was written
|
||||
TAB_PATH="$MOCKS_DIR/nodejs.org-download-nightly-index.tab"
|
||||
nvm_download() {
|
||||
cat "$TAB_PATH"
|
||||
}
|
||||
|
||||
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote nightly.txt"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote foo)"
|
||||
EXIT_CODE="$(nvm_ls_remote foo >/dev/null 2>&1 ; echo $?)"
|
||||
[ "_$OUTPUT" = "_N/A" ] || die "nonexistent version did not report N/A"
|
||||
[ "_$EXIT_CODE" = "_3" ] || die "nonexistent version did not exit with code 3, got $EXIT_CODE"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote)"
|
||||
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm_ls_remote did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote 10.0)"
|
||||
EXPECTED_OUTPUT="v10.0.0-nightly20180424982adb5994
|
||||
v10.0.1-nightly20180505ff148b987d"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote 10.0 did not output 10.0 nightly versions; got $OUTPUT"
|
||||
|
||||
# Sanity checks
|
||||
OUTPUT="$(nvm_print_implicit_alias remote stable)"
|
||||
EXPECTED_OUTPUT_PATH="${MOCKS_DIR}/nvm_print_implicit_alias remote stable nightly.txt"
|
||||
EXPECTED_OUTPUT="$(cat "${EXPECTED_OUTPUT_PATH}")"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT"
|
||||
|
||||
OUTPUT="$(nvm_print_implicit_alias remote unstable)"
|
||||
EXPECTED_OUTPUT="N/A"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_print_implicit_alias remote unstable did not output |$EXPECTED_OUTPUT|; got |$OUTPUT|"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote stable)"
|
||||
EXPECTED_OUTPUT_PATH="${MOCKS_DIR}/nvm_ls_remote stable nightly.txt"
|
||||
EXPECTED_OUTPUT="$(cat "${EXPECTED_OUTPUT_PATH}")"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote stable did not output $EXPECTED_OUTPUT; got $OUTPUT"
|
||||
|
||||
OUTPUT="$(nvm_ls_remote unstable)"
|
||||
EXPECTED_OUTPUT="N/A"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote unstable did not output |$EXPECTED_OUTPUT|; got |$OUTPUT|"
|
||||
|
||||
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote LTS nightly.txt"
|
||||
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
|
||||
OUTPUT="$(NVM_LTS='*' nvm_ls_remote)"
|
||||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS='*' nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
|
||||
|
||||
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote LTS nightly argon.txt"
|
||||
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
|
||||
OUTPUT="$(NVM_LTS=argon nvm_ls_remote)"
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS=argon nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
|
||||
|
||||
cleanup
|
||||
@@ -14,13 +14,14 @@ cleanup() {
|
||||
}
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
mkdir "${NVM_DIR}/v0.2.3"
|
||||
mkdir "${NVM_DIR}/v0.3.4"
|
||||
mkdir "${NVM_DIR}/v0.4.6"
|
||||
mkdir "${NVM_DIR}/v0.5.7"
|
||||
mkdir "${NVM_DIR}/v0.7.7"
|
||||
mkdir -p "${NVM_DIR}/versions/io.js/v0.98.0"
|
||||
make_fake_node v0.2.3
|
||||
make_fake_node v0.3.4
|
||||
make_fake_node v0.4.6
|
||||
make_fake_node v0.5.7
|
||||
make_fake_node v0.7.7
|
||||
make_fake_iojs v0.98.0
|
||||
|
||||
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
|
||||
[ "_$LATEST_STABLE" = "_0.4" ] || die "local stable is not latest even minor: expected 0.4, got $LATEST_STABLE"
|
||||
@@ -35,8 +36,9 @@ LATEST_IOJS="$(nvm_print_implicit_alias local iojs)"
|
||||
[ "_$LATEST_IOJS" = "_iojs-v0.98" ] || die "local iojs is not latest iojs: expected iojs-v0.98, got $LATEST_IOJS"
|
||||
|
||||
## node post v1.0/io.js merger ##
|
||||
mkdir -p "${NVM_DIR}/versions/node/v1.0.0"
|
||||
mkdir -p "${NVM_DIR}/versions/node/v1.1.0"
|
||||
make_fake_node v1.0.0
|
||||
make_fake_node v1.1.0
|
||||
|
||||
|
||||
LATEST_STABLE="$(nvm_print_implicit_alias local stable)"
|
||||
[ "_$LATEST_STABLE" = "_1.1" ] || die "local stable when post-v1.0 exists is not latest: expected 1.1, got $LATEST_STABLE"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
export NVM_DIR_BASE="/tmp"
|
||||
export NVM_DIR="${NVM_DIR_BASE}/"
|
||||
|
||||
\. ../../nvm.sh
|
||||
|
||||
[ "${NVM_DIR}" = "${NVM_DIR_BASE}" ] || die 'nvm should remove the last trailing slash in "$NVM_DIR"'
|
||||
|
||||
export NVM_DIR="${NVM_DIR_BASE}//"
|
||||
|
||||
\. ../../nvm.sh
|
||||
|
||||
[ "${NVM_DIR}" = "${NVM_DIR_BASE}" ] || die 'nvm should remove all the last trailing slashes in "$NVM_DIR"'
|
||||
@@ -28,6 +28,12 @@ setup
|
||||
# Confirm profile detection via $SHELL works and that $PROFILE overrides profile detection
|
||||
#
|
||||
|
||||
# setting $PROFILE to /dev/null should return no detected profile
|
||||
NVM_DETECT_PROFILE="$(PROFILE='/dev/null'; nvm_detect_profile)"
|
||||
if [ -n "$NVM_DETECT_PROFILE" ]; then
|
||||
die "nvm_detect_profile still detected a profile even though PROFILE=/dev/null"
|
||||
fi
|
||||
|
||||
# .bashrc should be detected for bash
|
||||
NVM_DETECT_PROFILE="$(BASH_VERSION="1"; unset PROFILE; nvm_detect_profile)"
|
||||
if [ "$NVM_DETECT_PROFILE" != "$HOME/.bashrc" ]; then
|
||||
|
||||
@@ -16,9 +16,10 @@ install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_$NVM_DIR" ] || die "nvm_install_dir should use \$NVM_DIR if it exists. Current output: $install_dir"
|
||||
|
||||
unset NVM_DIR
|
||||
|
||||
# NVM_DIR is not set
|
||||
install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir"
|
||||
fallback_dir=""
|
||||
[ ! -z "$XDG_CONFIG_HOME" ] && fallback_dir="$XDG_CONFIG_HOME/nvm" || fallback_dir="$HOME/.nvm"
|
||||
[ "_$install_dir" = "_$fallback_dir" ] || die "nvm_install_dir should default to \$XDG_CONFIG_DIR/.nvm. Current output: $install_dir"
|
||||
|
||||
cleanup
|
||||
|
||||
@@ -19,6 +19,12 @@ fail() {
|
||||
|
||||
! nvm_is_version_installed "${VERSION}" || nvm uninstall "${VERSION}" || die 'uninstall failed'
|
||||
|
||||
# an existing but empty VERSION_PATH directory should not be enough to satisfy nvm_is_version_installed
|
||||
rm -rf "${VERSION_PATH}"
|
||||
mkdir -p "${VERSION_PATH}"
|
||||
nvm_is_version_installed "${VERSION}" && die 'nvm_is_version_installed check not strict enough'
|
||||
rmdir "${VERSION_PATH}"
|
||||
|
||||
OUTPUT="$(NVM_INSTALL_THIRD_PARTY_HOOK=succeed nvm install "${VERSION}")"
|
||||
USE_OUTPUT="$(nvm use "${VERSION}")"
|
||||
EXPECTED_OUTPUT="${VERSION} node std binary ${VERSION_PATH}
|
||||
|
||||
@@ -26,6 +26,8 @@ nvm install-latest-npm || die 'nvm install-latest-npm failed: 3'
|
||||
NPM_VERSION="$(npm --version)"
|
||||
[ "${NPM_VERSION}" = '4.6.1' ] || die "io.js v1.x updates to ${NPM_VERSION}; expected v4.6.1"
|
||||
|
||||
export NPM_CONFIG_STRICT_SSL=false # the npm registry tightened up their SSL certs
|
||||
|
||||
nvm deactivate >/dev/null 2>&1 || die 'unable to deactivate: 4'
|
||||
nvm install 0.8.27 >/dev/null 2>&1 || die 'install v0.8 failed'
|
||||
nvm install-latest-npm || die 'nvm install-latest-npm failed: 4'
|
||||
@@ -35,7 +37,6 @@ NPM_VERSION="$(npm --version)"
|
||||
## Commented to work around travis-ci breaking 0,6 installs
|
||||
# nvm deactivate >/dev/null 2>&1 || die 'unable to deactivate: 5'
|
||||
# nvm install 0.6.21 >/dev/null 2>&1 || die 'install v0.6 failed'
|
||||
# export NPM_CONFIG_STRICT_SSL=false # npm 1 on travis can't handle SSL to npm
|
||||
# nvm install-latest-npm || die 'nvm install-latest-npm failed: 5'
|
||||
# NPM_VERSION="$(npm --version)"
|
||||
# [ "${NPM_VERSION}" = '1.3.26' ] || die "node 0.6.21 updates to ${NPM_VERSION}; expected v1.3.26"
|
||||
|
||||
@@ -5,29 +5,29 @@ die () { echo "$@" ; exit 1; }
|
||||
\. ../../nvm.sh
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e "${NVM_DIR}/v0.9.7" ] && rm -R "${NVM_DIR}/v0.9.7"
|
||||
[ -e "${NVM_DIR}/v0.9.12" ] && rm -R "${NVM_DIR}/v0.9.12"
|
||||
[ -e "${NVM_DIR}/versions/node/v9.7.0" ] && rm -R "${NVM_DIR}/versions/node/v9.7.0"
|
||||
[ -e "${NVM_DIR}/versions/node/v9.10.0" ] && rm -R "${NVM_DIR}/versions/node/v9.10.0"
|
||||
|
||||
# Install from binary
|
||||
nvm install 0.9.7
|
||||
nvm install 9.7.0
|
||||
|
||||
# Check
|
||||
[ -d "${NVM_DIR}/v0.9.7" ] || die "nvm install 0.9.7 didn't install"
|
||||
[ -d "${NVM_DIR}/versions/node/v9.7.0" ] || die "nvm install 9.7.0 didn't install"
|
||||
|
||||
nvm use 0.9.7
|
||||
nvm use 9.7.0
|
||||
|
||||
node --version | grep v0.9.7 > /dev/null || die "nvm use 0.9.7 failed"
|
||||
node --version | grep v9.7.0 > /dev/null || die "nvm use 9.7.0 failed"
|
||||
|
||||
npm install -g object-is@0.0.0 || die "npm install -g object-is failed"
|
||||
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
|
||||
|
||||
nvm ls 0.9 | grep v0.9.7 > /dev/null || die "nvm ls 0.9 didn't show v0.9.7"
|
||||
nvm ls 9 | grep v9.7.0 > /dev/null || die "nvm ls 9 didn't show v9.7.0"
|
||||
|
||||
nvm install 0.9.12 --reinstall-packages-from=0.9 || die "nvm install 0.9.12 --reinstall-packages-from=0.9 failed"
|
||||
nvm install 9.10.0 --reinstall-packages-from=9 || die "nvm install 9.10.0 --reinstall-packages-from=9 failed"
|
||||
|
||||
[ -d "${NVM_DIR}/v0.9.12" ] || die "nvm install 0.9.12 didn't install"
|
||||
[ -d "${NVM_DIR}/versions/node/v9.10.0" ] || die "nvm install 9.10.0 didn't install"
|
||||
|
||||
nvm use 0.9
|
||||
node --version | grep v0.9.12 > /dev/null || die "nvm ls 0.9 didn't use v0.9.12"
|
||||
nvm use 9
|
||||
node --version | grep v9.10.0 > /dev/null || die "nvm ls 9 didn't use v9.10.0"
|
||||
|
||||
npm list --global | grep object-is > /dev/null || die "object-is isn't installed"
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
nvm deactivate
|
||||
nvm uninstall v0.10.7
|
||||
nvm uninstall v4.2.2
|
||||
nvm uninstall v0.9.7
|
||||
nvm uninstall v9.7.0
|
||||
nvm uninstall v0.9.12
|
||||
nvm uninstall v9.10.0
|
||||
|
||||
if [ -f ".nvmrc" ]; then
|
||||
rm .nvmrc
|
||||
|
||||
@@ -10,7 +10,7 @@ nvm exec 0.10.29 npm install -g npm@~1.4.11 && nvm install-latest-npm # this is
|
||||
nvm use 0.10.28
|
||||
(cd test-npmlink && npm link)
|
||||
|
||||
EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame spawn-sync test-npmlink uglify-js"
|
||||
EXPECTED_PACKAGES="autoprefixer bower david grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame spawn-sync test-npmlink uglify-js"
|
||||
|
||||
echo "$EXPECTED_PACKAGES yo@1" | sed -e 's/test-npmlink //' | xargs npm install -g --quiet
|
||||
|
||||
|
||||
20
test/sourcing/Sourcing nvm.sh should keep version if one is active
Executable file
20
test/sourcing/Sourcing nvm.sh should keep version if one is active
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
echo '0.10.1' > ../../alias/default || die "couldn't create default alias"
|
||||
|
||||
\. ../../nvm.sh || die 'sourcing returned nonzero exit code'
|
||||
|
||||
NVM_TARGET=0.10.3
|
||||
NVM_DEFAULT="$(nvm_resolve_local_alias default)"
|
||||
|
||||
[ "_$NVM_DEFAULT" != "_$NVM_TARGET" ] || die "default $NVM_DEFAULT is the same as target $NVM_TARGET"
|
||||
|
||||
nvm use $NVM_TARGET || die "nvm use $NVM_TARGET failed"
|
||||
|
||||
\. ../../nvm.sh || die 'sourcing returned nonzero exit code'
|
||||
|
||||
NVM_CURRENT="$(nvm current)"
|
||||
|
||||
[ "_${NVM_CURRENT#v}" = "_$NVM_TARGET" ] || die "node version not retained after sourcing"
|
||||
@@ -2,13 +2,24 @@
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
echo '0.10.1' > ../../alias/default || die 'creation of default alias failed'
|
||||
|
||||
\. ../../nvm.sh || die 'sourcing returned nonzero exit code'
|
||||
\. ../common.sh
|
||||
|
||||
# We need to unload nvm again first, as by the time this test is run,
|
||||
# despite being unloaded in setup, the inherited PATH still contains
|
||||
# an nvm-installed node version. We have to reset NVM_DIR after the unload.
|
||||
\. ../../nvm.sh || die 'sourcing returned nonzero exit code'
|
||||
NVM_DIR_CACHED="$NVM_DIR"
|
||||
nvm unload || die 'unloading returned nonzero exit code'
|
||||
NVM_DIR="$NVM_DIR_CACHED"
|
||||
|
||||
echo '0.10.1' > ../../alias/default || die 'creation of default alias failed'
|
||||
|
||||
# Now to begin the real test
|
||||
\. ../../nvm.sh || die 'sourcing returned nonzero exit code'
|
||||
|
||||
NVM_LS_CURRENT_NOT_GREPPED="$(nvm ls current | strip_colors)"
|
||||
NVM_LS_CURRENT="$(nvm ls current | strip_colors | \grep -o v0.10.1)"
|
||||
[ "_$NVM_LS_CURRENT" = '_v0.10.1' ] || die "'nvm ls current' did not return '-> v0.10.1', got '$NVM_LS_CURRENT'"
|
||||
[ "_$NVM_LS_CURRENT" = '_v0.10.1' ] || die "'nvm ls current' did not return '-> v0.10.1', got '$NVM_LS_CURRENT_NOT_GREPPED'"
|
||||
|
||||
# NVM_LS_CURRENT_COLORED="$(nvm ls current | sed -n l)"
|
||||
|
||||
@@ -9,5 +9,6 @@ rm -rf ../../v0.9.12
|
||||
|
||||
\. ../../nvm.sh
|
||||
nvm install 0.10.1 || echo >&2 'nvm install 0.10.1 failed'
|
||||
nvm install 0.10.3 || echo >&2 'nvm install 0.10.3 failed'
|
||||
nvm unalias default || 'removing default alias failed'
|
||||
nvm unload || echo >&2 'nvm unload failed'
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
rm -rf ../../alias
|
||||
rm -rf ../../v0.10.1
|
||||
rm -rf ../../v0.10.2
|
||||
rm -rf ../../v0.10.3
|
||||
rm -f ../../.nvmrc
|
||||
|
||||
@@ -24,7 +24,7 @@ nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote.txt"
|
||||
nvm_ls_remote_iojs > "$MOCKS_DIR/nvm_ls_remote_iojs.txt"
|
||||
NVM_LTS=* nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS.txt"
|
||||
NVM_LTS=argon nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS argon.txt"
|
||||
nvm_download -L -s "$(nvm_get_mirror node std)/index.tab" -o - > "$MOCKS_DIR/nodejs.org-dist-index.tab"
|
||||
nvm_download -L -s "https://nodejs.org/download/nightly/index.tab" -o - > "$MOCKS_DIR/nodejs.org-download-nightly-index.tab"
|
||||
nvm_download -L -s "$(nvm_get_mirror iojs std)/index.tab" -o - > "$MOCKS_DIR/iojs.org-dist-index.tab"
|
||||
nvm ls-remote > "$MOCKS_DIR/nvm ls-remote.txt"
|
||||
nvm ls-remote --lts > "$MOCKS_DIR/nvm ls-remote lts.txt"
|
||||
@@ -33,6 +33,13 @@ nvm ls-remote iojs > "$MOCKS_DIR/nvm ls-remote iojs.txt"
|
||||
nvm_print_implicit_alias remote stable > "$MOCKS_DIR/nvm_print_implicit_alias remote stable.txt"
|
||||
nvm_ls_remote stable > "$MOCKS_DIR/nvm_ls_remote stable.txt"
|
||||
|
||||
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote nightly.txt"
|
||||
nvm_download -L -s "$(nvm_get_mirror node std)/index.tab" -o - > "$MOCKS_DIR/nodejs.org-dist-index.tab"
|
||||
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm_print_implicit_alias remote stable > "$MOCKS_DIR/nvm_print_implicit_alias remote stable nightly.txt"
|
||||
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ nvm_ls_remote stable > "$MOCKS_DIR/nvm_ls_remote stable nightly.txt"
|
||||
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ NVM_LTS=* nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS nightly.txt"
|
||||
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly/ NVM_LTS=argon nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS nightly argon.txt"
|
||||
|
||||
ALIAS_PATH="$MOCKS_DIR/nvm_make_alias LTS alias calls.txt"
|
||||
: > "$ALIAS_PATH"
|
||||
nvm_make_alias() {
|
||||
|
||||
Reference in New Issue
Block a user