mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-04 19:49:36 +00:00
Compare commits
56 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
aa71b65b94 | ||
![]() |
25365b3225 | ||
![]() |
c0fe20f544 | ||
![]() |
7d67b26f76 | ||
![]() |
1eca354233 | ||
![]() |
0a4e6f2b70 | ||
![]() |
94a72ae217 | ||
![]() |
011810e721 | ||
![]() |
d48abff659 | ||
![]() |
82037b41b1 | ||
![]() |
7b0a46eafb | ||
![]() |
dcbecbf2c7 | ||
![]() |
970cadf258 | ||
![]() |
3cc9525dce | ||
![]() |
6537c91eb5 | ||
![]() |
07b20d5008 | ||
![]() |
0b5bb5ccd8 | ||
![]() |
45c1b84794 | ||
![]() |
3664744e3b | ||
![]() |
ee9e56582e | ||
![]() |
e7a5b7992b | ||
![]() |
ff77ac17af | ||
![]() |
2410215b6a | ||
![]() |
a1abfd1fe4 | ||
![]() |
43402df896 | ||
![]() |
1ede50cbae | ||
![]() |
e0d87528f3 | ||
![]() |
924a175bd8 | ||
![]() |
9daf26f0a0 | ||
![]() |
226487d358 | ||
![]() |
216c24fba0 | ||
![]() |
930507dbbc | ||
![]() |
4c8ced736d | ||
![]() |
1f7f0c2d81 | ||
![]() |
41eb40821b | ||
![]() |
c6740f5a6e | ||
![]() |
04fdb2331b | ||
![]() |
58d0933f72 | ||
![]() |
2a5d2c06ff | ||
![]() |
2a513a1bc0 | ||
![]() |
48196d2436 | ||
![]() |
7f9220dbd8 | ||
![]() |
890fbb5581 | ||
![]() |
e1bb44f712 | ||
![]() |
db19450caa | ||
![]() |
5c117e6ab3 | ||
![]() |
02997b0753 | ||
![]() |
cc0750eb5d | ||
![]() |
7e715d5c73 | ||
![]() |
66d2909650 | ||
![]() |
a56c6f1485 | ||
![]() |
703babe60a | ||
![]() |
10f24d6d4b | ||
![]() |
e367533eb8 | ||
![]() |
6534568745 | ||
![]() |
13f3cdcdf7 |
@@ -12,5 +12,11 @@ trim_trailing_whitespace = true
|
||||
[*.txt]
|
||||
indent_size = false
|
||||
|
||||
[test/fast/Listing versions/Running "nvm ls" calls into nvm_alias]
|
||||
indent_size = false
|
||||
|
||||
[test/fast/Listing versions/Running "nvm ls --no-alias" does not call into nvm_alias]
|
||||
indent_size = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
52
.github/ISSUE_TEMPLATE.md
vendored
52
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,42 +1,44 @@
|
||||
|
||||
<!-- Thank you for being interested in nvm! Please help us by filling out the following form if you‘re having trouble. If you have a feature request, or some other question, please feel free to clear out the form. Thanks! -->
|
||||
|
||||
- Operating system and version:
|
||||
#### Operating system and version:
|
||||
|
||||
- `nvm debug` output:
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
#### `nvm debug` output:
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
|
||||
```sh
|
||||
```sh
|
||||
|
||||
```
|
||||
</details>
|
||||
```
|
||||
</details>
|
||||
|
||||
- `nvm ls` output:
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
#### `nvm ls` output:
|
||||
<details>
|
||||
<!-- do not delete the following blank line -->
|
||||
|
||||
```sh
|
||||
```sh
|
||||
|
||||
```
|
||||
</details>
|
||||
```
|
||||
</details>
|
||||
|
||||
- How did you install `nvm`? (e.g. install script in readme, Homebrew):
|
||||
#### How did you install `nvm`?
|
||||
<!-- (e.g. install script in readme, Homebrew) -->
|
||||
|
||||
- What steps did you perform?
|
||||
#### What steps did you perform?
|
||||
|
||||
- What happened?
|
||||
#### What happened?
|
||||
|
||||
- What did you expect to happen?
|
||||
#### What did you expect to happen?
|
||||
|
||||
- Is there anything in any of your profile files (`.bashrc`, `.bash_profile`, `.zshrc`, etc) that modifies the `PATH`?
|
||||
#### Is there anything in any of your profile files that modifies the `PATH`?
|
||||
<!-- (e.g. `.bashrc`, `.bash_profile`, `.zshrc`, etc) -->
|
||||
|
||||
<!-- 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 -->
|
||||
<!-- Please remove the following section if it does not apply to you -->
|
||||
#### 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 -->
|
||||
|
||||
```sh
|
||||
```sh
|
||||
|
||||
```
|
||||
</details>
|
||||
```
|
||||
</details>
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -15,7 +15,7 @@ npm-debug.log
|
||||
|
||||
.DS_Store
|
||||
current
|
||||
default-packages
|
||||
/default-packages
|
||||
|
||||
# Only apps should have lockfiles
|
||||
npm-shrinkwrap.json
|
||||
|
@@ -1,5 +1,5 @@
|
||||
language: generic
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
sudo: required
|
||||
addons:
|
||||
apt:
|
||||
@@ -36,8 +36,8 @@ before_cache:
|
||||
- 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
|
||||
- CXX=g++
|
||||
- CC=gcc
|
||||
- PATH="$(echo $PATH | sed 's/::/:/')"
|
||||
- PATH="/usr/lib/ccache/:$PATH"
|
||||
- NVM_DIR="${TRAVIS_BUILD_DIR}"
|
||||
|
81
CODE_OF_CONDUCT.md
Normal file
81
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at ljharb@gmail.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
|
||||
## OpenJS Foundation
|
||||
|
||||
As a member of the OpenJS Foundation, this project also follows the Foundation’s overarching
|
||||
[Code of Conduct](https://github.com/openjs-foundation/cross-project-council/blob/master/CODE_OF_CONDUCT.md).
|
@@ -20,7 +20,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# ShellCheck version
|
||||
ENV SHELLCHECK_VERSION=0.5.0
|
||||
ENV SHELLCHECK_VERSION=0.6.0
|
||||
|
||||
# Pick a Ubuntu apt mirror site for better speed
|
||||
# ref: https://launchpad.net/ubuntu/+archivemirrors
|
||||
@@ -42,6 +42,7 @@ RUN apt update && \
|
||||
bsdutils \
|
||||
file \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
ca-certificates \
|
||||
ssh \
|
||||
wget \
|
||||
|
@@ -2,6 +2,8 @@ The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010 Tim Caswell
|
||||
|
||||
Copyright (c) 2014 Jordan Harband
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
|
162
README.md
162
README.md
@@ -1,11 +1,15 @@
|
||||
# Node Version Manager [][3] [][4] [](https://bestpractices.coreinfrastructure.org/projects/684)
|
||||
# Node Version Manager [][3] [][4] [](https://bestpractices.coreinfrastructure.org/projects/684)
|
||||
|
||||
<br />
|
||||
`nvm` is an <img alt="OpenJS Foundation" src="https://raw.githubusercontent.com/openjs-foundation/cross-project-council/master/logos/openjsf-color.png" width="150" align="left" /> project, and we follow our <a href="https://github.com/nvm-sh/nvm/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a>.
|
||||
<br /><br />
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
## Table of Contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Install script](#install-script)
|
||||
- [Installation and Update](#installation-and-update)
|
||||
- [Install & Update script](#install--update-script)
|
||||
- [Ansible](#ansible)
|
||||
- [Verify installation](#verify-installation)
|
||||
- [Important Notes](#important-notes)
|
||||
@@ -19,6 +23,7 @@
|
||||
- [io.js](#iojs)
|
||||
- [System version of node](#system-version-of-node)
|
||||
- [Listing versions](#listing-versions)
|
||||
- [Suppressing colorized output](#suppressing-colorized-output)
|
||||
- [.nvmrc](#nvmrc)
|
||||
- [Deeper Shell Integration](#deeper-shell-integration)
|
||||
- [bash](#bash)
|
||||
@@ -39,31 +44,28 @@
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Installation
|
||||
## Installation and Update
|
||||
|
||||
### Install script
|
||||
|
||||
To install or update nvm, you can use the [install script][2] using cURL:
|
||||
### Install & Update script
|
||||
|
||||
To **install** or **update** nvm, you should run the [install script][2]. To do that, you may either download and run the script manually, or use the following cURL or Wget command:
|
||||
```sh
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
|
||||
```
|
||||
```sh
|
||||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
|
||||
```
|
||||
|
||||
or Wget:
|
||||
Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and adds the source lines from the snippet below to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).
|
||||
|
||||
<a id="profile_snippet"></a>
|
||||
```sh
|
||||
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="${XDG_CONFIG_HOME/:-$HOME/.}nvm"
|
||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
```
|
||||
|
||||
<sub>**Note:** If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub>
|
||||
|
||||
**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.
|
||||
@@ -71,26 +73,20 @@ Eg: `curl ... | NVM_DIR="path/to/nvm"`. Ensure that the `NVM_DIR` does not conta
|
||||
|
||||
<sub>*NB. The installer can use `git`, `curl`, or `wget` to download `nvm`, whatever is available.*</sub>
|
||||
|
||||
**Note:** On Linux, after running the install script, if you get `nvm: command not found` or see no feedback from your terminal after you type:
|
||||
**Note:** On Linux, after running the install script, if you get `nvm: command not found` or see no feedback from your terminal after you type `command -v nvm`, simply close your current terminal, open a new terminal, and try verifying again.
|
||||
|
||||
```sh
|
||||
command -v nvm
|
||||
```
|
||||
**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/nvm-sh/nvm/issues/1782))
|
||||
|
||||
simply close your current terminal, open a new terminal, and try verifying again.
|
||||
**Note:** On OS X, if you get `nvm: command not found` after running the install script, one of the following might be the reason:
|
||||
|
||||
**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))
|
||||
- Your system may not have a `.bash_profile` file where the command is set up. 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.
|
||||
|
||||
**Note:** On OS X, if you get `nvm: command not found` after running the install script, one of the following might be the reason:-
|
||||
If the above doesn't fix the problem, you may try the following:
|
||||
- Open your `.bash_profile` (or `~/.zshrc`, `~/.profile`, or `~/.bashrc`) and add the following line of code: `source ~/<your_profile_file>`. E.g. `source ~/.bashrc` or `source ~/.zshrc`.
|
||||
- If the above don't work, try adding the [snippet from the install section](#profile_snippet) that finds the correct nvm directory and loads nvm, to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).
|
||||
|
||||
- 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.
|
||||
|
||||
If the above doesn't fix the problem, open your `.bash_profile` and add the following line of code:
|
||||
|
||||
`source ~/.bashrc`
|
||||
|
||||
- For more information about this issue and possible workarounds, please [refer here](https://github.com/creationix/nvm/issues/576)
|
||||
- For more information about this issue and possible workarounds, please [refer here](https://github.com/nvm-sh/nvm/issues/576)
|
||||
|
||||
#### Ansible
|
||||
You can use a task:
|
||||
@@ -98,7 +94,7 @@ If the above doesn't fix the problem, open your `.bash_profile` and add the foll
|
||||
```
|
||||
- name: nvm
|
||||
shell: >
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
|
||||
args:
|
||||
creates: "{{ ansible_env.HOME }}/.nvm/nvm.sh"
|
||||
```
|
||||
@@ -111,18 +107,18 @@ To verify that nvm has been installed, do:
|
||||
command -v nvm
|
||||
```
|
||||
|
||||
which should output 'nvm' if the installation was successful. Please note that `which nvm` will not work, since `nvm` is a sourced shell function, not an executable binary.
|
||||
which should output `nvm` if the installation was successful. Please note that `which nvm` will not work, since `nvm` is a sourced shell function, not an executable binary.
|
||||
|
||||
### Important Notes
|
||||
|
||||
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:
|
||||
**Note:** `nvm` does not support Windows (see [#284](https://github.com/nvm-sh/nvm/issues/284)), but may work in WSL (Windows Subsystem for Linux) depending on the version of WSL. For Windows, 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:
|
||||
**Note:** `nvm` does not support [Fish] either (see [#303](https://github.com/nvm-sh/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
|
||||
@@ -132,7 +128,7 @@ If you're running a system without prepackaged binary available, which means you
|
||||
|
||||
**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/nvm-sh/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:
|
||||
@@ -141,24 +137,24 @@ If you're running a system without prepackaged binary available, which means you
|
||||
|
||||
**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/*`
|
||||
- When using `nvm` you do not need `sudo` to globally install a module with `npm -g`, so instead of doing `sudo npm install -g grunt`, do instead `npm install -g grunt`
|
||||
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with `nvm`)
|
||||
- You can (but should not?) keep your previous "system" node install, but `nvm` will only be available to your user account (the one used to install nvm). This might cause version mismatches, as other users will be using `/usr/local/lib/node_modules/*` VS your user account using `~/.nvm/versions/node/vX.X.X/lib/node_modules/*`
|
||||
|
||||
Homebrew installation is not supported. If you have issues with homebrew-installed `nvm`, please `brew uninstall` it, and install it using the instructions below, before filing an issue.
|
||||
|
||||
**Note:** If you're using `zsh` you can easily install `nvm` as a zsh plugin. Install [`zsh-nvm`](https://github.com/lukechilds/zsh-nvm) and run `nvm upgrade` to upgrade.
|
||||
|
||||
**Note:** Git versions before v1.7 may face a problem of cloning nvm source from GitHub via https protocol, and there is also different behavior of git before v1.6, and git prior to [v1.17.10](https://github.com/git/git/commit/5a7d5b683f869d3e3884a89775241afa515da9e7) can not clone tags, so the minimum required git version is v1.7.10. If you are interested in the problem we mentioned here, please refer to GitHub's [HTTPS cloning errors](https://help.github.com/articles/https-cloning-errors/) article.
|
||||
**Note:** Git versions before v1.7 may face a problem of cloning `nvm` source from GitHub via https protocol, and there is also different behavior of git before v1.6, and git prior to [v1.17.10](https://github.com/git/git/commit/5a7d5b683f869d3e3884a89775241afa515da9e7) can not clone tags, so the minimum required git version is v1.7.10. If you are interested in the problem we mentioned here, please refer to GitHub's [HTTPS cloning errors](https://help.github.com/articles/https-cloning-errors/) article.
|
||||
|
||||
### Git install
|
||||
|
||||
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`
|
||||
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`
|
||||
- `cd ~/` from anywhere then `git clone https://github.com/nvm-sh/nvm.git .nvm`
|
||||
1. `cd ~/.nvm` and check out the latest version with `git checkout v0.35.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)
|
||||
@@ -171,11 +167,11 @@ export NVM_DIR="$HOME/.nvm"
|
||||
|
||||
### Manual Install
|
||||
|
||||
For a fully manual install, execute the following lines to first clone the nvm repository into `$HOME/.nvm`, and then load nvm:
|
||||
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" && (
|
||||
git clone https://github.com/creationix/nvm.git "$NVM_DIR"
|
||||
git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
|
||||
cd "$NVM_DIR"
|
||||
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
|
||||
) && \. "$NVM_DIR/nvm.sh"
|
||||
@@ -220,7 +216,9 @@ To install a specific version of node:
|
||||
nvm install 6.14.4 # or 10.10.0, 8.9.1, etc
|
||||
```
|
||||
|
||||
You can list available versions using ls-remote:
|
||||
The first version installed becomes the default. New shells will start with the default version of node (e.g., `nvm alias default`).
|
||||
|
||||
You can list available versions using `ls-remote`:
|
||||
|
||||
```sh
|
||||
nvm ls-remote
|
||||
@@ -259,7 +257,7 @@ In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the f
|
||||
|
||||
### 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:
|
||||
Node has a [schedule](https://github.com/nodejs/Release#release-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`
|
||||
@@ -288,9 +286,25 @@ nvm install 6 --reinstall-packages-from=5
|
||||
nvm install v4.2 --reinstall-packages-from=iojs
|
||||
```
|
||||
|
||||
Note that reinstalling packages _explicitly does not update the npm version_ — this is to ensure that npm isn't accidentally upgraded to a broken version for the new node version.
|
||||
|
||||
To update npm at the same time add the `--latest-npm` flag, like this:
|
||||
|
||||
```sh
|
||||
nvm install lts/* --reinstall-packages-from=default --latest-npm
|
||||
```
|
||||
|
||||
or, you can at any time run the following command to get the latest supported npm version on the current node version:
|
||||
```sh
|
||||
nvm install-latest-npm
|
||||
```
|
||||
|
||||
If you've already gotten an error to the effect of "npm does not support Node.js", you'll need to (1) revert to a previous node version (`nvm ls` & `nvm use <your latest _working_ version from the ls>`, (2) delete the newly created node version (`nvm uninstall <your _broken_ version of node from the ls>`), then (3) rerun your `nvm install` with the `--latest-npm` flag.
|
||||
|
||||
|
||||
### Default global packages from file while installing
|
||||
|
||||
If you have a list of default packages you want installed every time you install a new version we support that too. You can add anything npm would accept as a package argument on the command line.
|
||||
If you have a list of default packages you want installed every time you install a new version, we support that too -- just add the package names, one per line, to the file `$NVM_DIR/default-packages`. You can add anything npm would accept as a package argument on the command line.
|
||||
|
||||
```sh
|
||||
# $NVM_DIR/default-packages
|
||||
@@ -314,7 +328,7 @@ If you want to install a new version of io.js and migrate npm packages from a pr
|
||||
nvm install iojs --reinstall-packages-from=iojs
|
||||
```
|
||||
|
||||
The same guidelines mentioned for migrating npm packages in Node.js are applicable to io.js.
|
||||
The same guidelines mentioned for migrating npm packages in node are applicable to io.js.
|
||||
|
||||
### System version of node
|
||||
|
||||
@@ -339,6 +353,15 @@ If you want to see what versions are available to install:
|
||||
nvm ls-remote
|
||||
```
|
||||
|
||||
#### Suppressing colorized output
|
||||
|
||||
`nvm ls`, `nvm ls-remote` and `nvm alias` usually produce colorized output. You can disable colors with the `--no-colors` option (or by setting the environment variable `TERM=dumb`):
|
||||
|
||||
```sh
|
||||
nvm ls --no-colors
|
||||
TERM=dumb nvm ls
|
||||
```
|
||||
|
||||
To restore your PATH, you can deactivate it:
|
||||
|
||||
```sh
|
||||
@@ -445,17 +468,18 @@ cdnvm(){
|
||||
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
|
||||
declare locally_resolved_nvm_version
|
||||
# `nvm ls` will check all locally-available versions
|
||||
# If there are multiple matching versions, take the latest one
|
||||
# Remove the `->` and `*` characters and spaces
|
||||
# `locally_resolved_nvm_version` will be `N/A` if no local versions are found
|
||||
locally_resolved_nvm_version=$(nvm ls --no-colors "$nvm_version" | tail -1 | tr -d '\->*' | tr -d '[:space:]')
|
||||
|
||||
# If it is not already installed, install it
|
||||
if [[ $(nvm ls "$nvm_version" | tr -d '[:space:]') == "N/A" ]]; then
|
||||
# `nvm install` will implicitly use the newly-installed version
|
||||
if [[ "$locally_resolved_nvm_version" == "N/A" ]]; then
|
||||
nvm install "$nvm_version";
|
||||
fi
|
||||
|
||||
if [[ $(nvm current) != "$nvm_version" ]]; then
|
||||
elif [[ $(nvm current) != "$locally_resolved_nvm_version" ]]; then
|
||||
nvm use "$nvm_version";
|
||||
fi
|
||||
fi
|
||||
@@ -616,7 +640,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.34.0/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.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.
|
||||
@@ -627,13 +651,13 @@ As a potential alternative, @mhart (a Node contributor) has some [Docker images
|
||||
|
||||
### Manual Uninstall
|
||||
|
||||
To remove nvm manually, execute the following:
|
||||
To remove `nvm` manually, execute the following:
|
||||
|
||||
```sh
|
||||
$ rm -rf "$NVM_DIR"
|
||||
```
|
||||
|
||||
Edit ~/.bashrc (or other shell resource config) and remove the lines below:
|
||||
Edit `~/.bashrc` (or other shell resource config) and remove the lines below:
|
||||
|
||||
```sh
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
@@ -675,11 +699,11 @@ For more information and documentation about docker, please refer to its officia
|
||||
|
||||
## Problems
|
||||
|
||||
- If you try to install a node version and the installation fails, be sure to delete the node downloads from src (`~/.nvm/src/`) or you might get an error when trying to reinstall them again or you might get an error like the following:
|
||||
- If you try to install a node version and the installation fails, be sure to run `nvm cache clear` to delete cached node downloads, or you might get an error like the following:
|
||||
|
||||
curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume.
|
||||
|
||||
- Where's my `sudo node`? Check out [#43](https://github.com/creationix/nvm/issues/43)
|
||||
- Where's my `sudo node`? Check out [#43](https://github.com/nvm-sh/nvm/issues/43)
|
||||
|
||||
- After the v0.8.6 release of node, nvm tries to install from binary packages. But in some systems, the official binary packages don't work due to incompatibility of shared libs. In such cases, use `-s` option to force install from source:
|
||||
|
||||
@@ -687,7 +711,7 @@ For more information and documentation about docker, please refer to its officia
|
||||
nvm install -s 0.8.6
|
||||
```
|
||||
|
||||
- If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node `PATH` is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658))
|
||||
- If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node `PATH` is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/nvm-sh/nvm/issues/658))
|
||||
|
||||
## Mac OS "troubleshooting"
|
||||
|
||||
@@ -701,9 +725,9 @@ 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.34.0/install.sh
|
||||
[3]: https://travis-ci.org/creationix/nvm
|
||||
[4]: https://github.com/creationix/nvm/releases/tag/v0.34.0
|
||||
[1]: https://github.com/nvm-sh/nvm.git
|
||||
[2]: https://github.com/nvm-sh/nvm/blob/v0.35.0/install.sh
|
||||
[3]: https://travis-ci.org/nvm-sh/nvm
|
||||
[4]: https://github.com/nvm-sh/nvm/releases/tag/v0.35.0
|
||||
[Urchin]: https://github.com/scraperwiki/urchin
|
||||
[Fish]: http://fishshell.com
|
||||
|
10
ROADMAP.md
10
ROADMAP.md
@@ -2,8 +2,8 @@
|
||||
|
||||
This is a list of the primary features planned for `nvm`:
|
||||
|
||||
- [x] Rewriting installation code paths to support installing `io.js` and `node` `v4+` [from source](https://github.com/creationix/nvm/issues/1188).
|
||||
- This will include [reusing previously downloaded tarballs](https://github.com/creationix/nvm/issues/1193) that match checksums, which is a nice performance and bandwidth bonus.
|
||||
- [ ] Adding opt-in environment variable support to list, download, and install `node` [release candidates](https://github.com/creationix/nvm/issues/779), and [nightly builds](https://github.com/creationix/nvm/issues/1053).
|
||||
- [ ] [`nvm update`](https://github.com/creationix/nvm/issues/400): the ability to autoupdate `nvm` itself
|
||||
- [ ] [v1.0.0](https://github.com/creationix/nvm/milestone/1), including updating the [nvm on npm](https://github.com/creationix/nvm/issues/304) to auto-install nvm properly
|
||||
- [x] Rewriting installation code paths to support installing `io.js` and `node` `v4+` [from source](https://github.com/nvm-sh/nvm/issues/1188).
|
||||
- This will include [reusing previously downloaded tarballs](https://github.com/nvm-sh/nvm/issues/1193) that match checksums, which is a nice performance and bandwidth bonus.
|
||||
- [ ] Adding opt-in environment variable support to list, download, and install `node` [release candidates](https://github.com/nvm-sh/nvm/issues/779), and [nightly builds](https://github.com/nvm-sh/nvm/issues/1053).
|
||||
- [ ] [`nvm update`](https://github.com/nvm-sh/nvm/issues/400): the ability to autoupdate `nvm` itself
|
||||
- [ ] [v1.0.0](https://github.com/nvm-sh/nvm/milestone/1), including updating the [nvm on npm](https://github.com/nvm-sh/nvm/issues/304) to auto-install nvm properly
|
||||
|
33
install.sh
33
install.sh
@@ -6,18 +6,20 @@ nvm_has() {
|
||||
type "$1" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
nvm_default_install_dir() {
|
||||
[ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm"
|
||||
}
|
||||
|
||||
nvm_install_dir() {
|
||||
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"
|
||||
nvm_default_install_dir
|
||||
fi
|
||||
}
|
||||
|
||||
nvm_latest_version() {
|
||||
echo "v0.34.0"
|
||||
echo "v0.35.0"
|
||||
}
|
||||
|
||||
nvm_profile_is_bash_or_zsh() {
|
||||
@@ -45,14 +47,14 @@ nvm_source() {
|
||||
local NVM_SOURCE_URL
|
||||
NVM_SOURCE_URL="$NVM_SOURCE"
|
||||
if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
|
||||
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
|
||||
NVM_SOURCE_URL="https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/nvm-exec"
|
||||
elif [ "_$NVM_METHOD" = "_script-nvm-bash-completion" ]; then
|
||||
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/bash_completion"
|
||||
NVM_SOURCE_URL="https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/bash_completion"
|
||||
elif [ -z "$NVM_SOURCE_URL" ]; then
|
||||
if [ "_$NVM_METHOD" = "_script" ]; then
|
||||
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
|
||||
NVM_SOURCE_URL="https://raw.githubusercontent.com/nvm-sh/nvm/$(nvm_latest_version)/nvm.sh"
|
||||
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
|
||||
NVM_SOURCE_URL="https://github.com/creationix/nvm.git"
|
||||
NVM_SOURCE_URL="https://github.com/nvm-sh/nvm.git"
|
||||
else
|
||||
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
|
||||
return 1
|
||||
@@ -304,8 +306,17 @@ nvm_check_global_modules() {
|
||||
|
||||
nvm_do_install() {
|
||||
if [ -n "${NVM_DIR-}" ] && ! [ -d "${NVM_DIR}" ]; then
|
||||
echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment."
|
||||
exit 1
|
||||
if [ -e "${NVM_DIR}" ]; then
|
||||
echo >&2 "File \"${NVM_DIR}\" has the same name as installation directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${NVM_DIR}" = "$(nvm_default_install_dir)" ]; then
|
||||
mkdir "${NVM_DIR}"
|
||||
else
|
||||
echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [ -z "${METHOD}" ]; then
|
||||
# Autodetect install method
|
||||
@@ -406,7 +417,7 @@ nvm_reset() {
|
||||
unset -f nvm_has nvm_install_dir nvm_latest_version nvm_profile_is_bash_or_zsh \
|
||||
nvm_source nvm_node_version nvm_download install_nvm_from_git nvm_install_node \
|
||||
install_nvm_as_script nvm_try_profile nvm_detect_profile nvm_check_global_modules \
|
||||
nvm_do_install nvm_reset
|
||||
nvm_do_install nvm_reset nvm_default_install_dir
|
||||
}
|
||||
|
||||
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvm",
|
||||
"version": "0.34.0",
|
||||
"version": "0.35.0",
|
||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/creationix/nvm.git"
|
||||
"url": "git://github.com/nvm-sh/nvm.git"
|
||||
},
|
||||
"keywords": [
|
||||
"nvm",
|
||||
@@ -32,9 +32,9 @@
|
||||
"author": "Tim Caswell <tim@creationix.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/creationix/nvm/issues"
|
||||
"url": "https://github.com/nvm-sh/nvm/issues"
|
||||
},
|
||||
"homepage": "https://github.com/creationix/nvm",
|
||||
"homepage": "https://github.com/nvm-sh/nvm",
|
||||
"devDependencies": {
|
||||
"dockerfile_lint": "^0.3.2",
|
||||
"eclint": "^2.6.0",
|
||||
|
@@ -29,8 +29,16 @@ make_fake_node() {
|
||||
VERSION="${1-}"
|
||||
[ -n "${VERSION}" ] || return 1
|
||||
|
||||
local FORMATTED_VERSION
|
||||
FORMATTED_VERSION="$(nvm_format_version "${VERSION}")"
|
||||
|
||||
local BIN_PATH
|
||||
BIN_PATH="$(nvm_version_path "${VERSION}")/bin"
|
||||
BIN_PATH="$(nvm_version_path "${FORMATTED_VERSION}")/bin"
|
||||
[ "${BIN_PATH}" != "/bin" ] || {
|
||||
echo >&2 'nvm_version_path was empty'
|
||||
return 5
|
||||
}
|
||||
|
||||
mkdir -p "${BIN_PATH}" || {
|
||||
echo >&2 'unable to make bin dir'
|
||||
return 2
|
||||
@@ -40,6 +48,11 @@ make_fake_node() {
|
||||
echo >&2 'unable to make fake node bin'
|
||||
return 3
|
||||
}
|
||||
|
||||
nvm_is_version_installed "${FORMATTED_VERSION}" || {
|
||||
echo >&2 'fake node is not installed'
|
||||
return 4
|
||||
}
|
||||
}
|
||||
|
||||
make_fake_iojs() {
|
||||
@@ -47,8 +60,16 @@ make_fake_iojs() {
|
||||
VERSION="${1-}"
|
||||
[ -n "${VERSION}" ] || return 1
|
||||
|
||||
local FORMATTED_VERSION
|
||||
FORMATTED_VERSION="$(nvm_format_version "iojs-${VERSION}")"
|
||||
|
||||
local BIN_PATH
|
||||
BIN_PATH="$(nvm_version_path "iojs-${VERSION}")/bin"
|
||||
BIN_PATH="$(nvm_version_path "${FORMATTED_VERSION}")/bin"
|
||||
[ "${BIN_PATH}" != "/bin" ] || {
|
||||
echo >&2 'nvm_version_path was empty'
|
||||
return 5
|
||||
}
|
||||
|
||||
mkdir -p "${BIN_PATH}" || {
|
||||
echo >&2 'unable to make bin dir'
|
||||
return 2
|
||||
@@ -62,6 +83,11 @@ make_fake_iojs() {
|
||||
echo >&2 'unable to make fake iojs bin'
|
||||
return 3
|
||||
}
|
||||
|
||||
nvm_is_version_installed "${FORMATTED_VERSION}" || {
|
||||
echo >&2 'fake iojs is not installed'
|
||||
return 4
|
||||
}
|
||||
}
|
||||
|
||||
watch() {
|
||||
|
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
OUTPUT="$(nvm unalias node 2>&1)"
|
||||
EXPECTED_OUTPUT="node is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias stable 2>&1)"
|
||||
EXPECTED_OUTPUT="stable is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias unstable 2>&1)"
|
||||
EXPECTED_OUTPUT="unstable is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias iojs 2>&1)"
|
||||
EXPECTED_OUTPUT="iojs is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias system 2>&1)"
|
||||
EXPECTED_OUTPUT="system is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
@@ -1,3 +1,3 @@
|
||||
rmdir ../../../v0.0.2 >/dev/null 2>&1
|
||||
rmdir ../../../v0.0.20 >/dev/null 2>&1
|
||||
rmdir ../../../v0.12.0 >/dev/null 2>&1
|
||||
rm -rf ../../../v0.0.2
|
||||
rm -rf ../../../v0.0.20
|
||||
rm -rf ../../../v0.12.0
|
||||
|
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
die () { echo "$@" ; unset -f nvm_ls nvm_list_aliases; exit 1; }
|
||||
|
||||
make_fake_node v0.12.87 || die 'fake v0.12.87 could not be made'
|
||||
make_fake_node v0.12.9 || die 'fake v0.12.9 could not be made'
|
||||
make_fake_iojs v0.1.2 || die 'fake iojs-v0.1.2 could not be made'
|
||||
make_fake_iojs v0.10.2 || die 'fake iojs-v0.10.2 could not be made'
|
||||
|
||||
set -e
|
||||
|
||||
nvm_list_aliases() {
|
||||
echo 'sd-6'
|
||||
}
|
||||
# sanity check
|
||||
OUTPUT="$(nvm alias)"
|
||||
EXPECTED_OUTPUT='sd-6'
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "1: expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
||||
|
||||
nvm_ls() {
|
||||
echo v0.12.87
|
||||
echo v0.12.9
|
||||
echo iojs-v0.1.2
|
||||
echo iojs-v0.10.2
|
||||
}
|
||||
OUTPUT="$(nvm ls --no-colors --no-alias)"
|
||||
EXPECTED_OUTPUT=" v0.12.87 *
|
||||
v0.12.9 *
|
||||
iojs-v0.1.2 *
|
||||
iojs-v0.10.2 *"
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "2: expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
15
test/fast/Listing versions/Running "nvm ls --no-alias" with a pattern errors
Executable file
15
test/fast/Listing versions/Running "nvm ls --no-alias" with a pattern errors
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
die () { echo "$@" ; unset -f nvm_ls nvm_list_aliases; exit 1; }
|
||||
|
||||
set -e
|
||||
|
||||
OUTPUT="$(nvm ls --no-colors --no-alias pattern 2>&1 ||:)"
|
||||
EXPECTED_OUTPUT='`--no-alias` is not supported when a pattern is provided.'
|
||||
EXIT_CODE="$(nvm ls --no-colors --no-alias pattern >/dev/null 2>&1 || echo $?)"
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
||||
|
||||
[ "${EXIT_CODE}" = 55 ] || die "expected 55; got >${EXIT_CODE}<"
|
35
test/fast/Listing versions/Running "nvm ls" calls into nvm_alias
Executable file
35
test/fast/Listing versions/Running "nvm ls" calls into nvm_alias
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
die () { echo "$@" ; unset -f nvm_ls nvm_list_aliases; exit 1; }
|
||||
|
||||
make_fake_node v0.12.87 || die 'fake v0.12.87 could not be made'
|
||||
make_fake_node v0.12.9 || die 'fake v0.12.9 could not be made'
|
||||
make_fake_iojs v0.1.2 || die 'fake iojs-v0.1.2 could not be made'
|
||||
make_fake_iojs v0.10.2 || die 'fake iojs-v0.10.2 could not be made'
|
||||
|
||||
set -e
|
||||
|
||||
nvm_list_aliases() {
|
||||
echo 'sd-6'
|
||||
}
|
||||
# sanity check
|
||||
OUTPUT="$(nvm alias)"
|
||||
EXPECTED_OUTPUT='sd-6'
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "1: expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
||||
|
||||
nvm_ls() {
|
||||
echo v0.12.87
|
||||
echo v0.12.9
|
||||
echo iojs-v0.1.2
|
||||
echo iojs-v0.10.2
|
||||
}
|
||||
OUTPUT="$(nvm ls --no-colors)"
|
||||
EXPECTED_OUTPUT=" v0.12.87 *
|
||||
v0.12.9 *
|
||||
iojs-v0.1.2 *
|
||||
iojs-v0.10.2 *
|
||||
sd-6"
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "2: expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
@@ -25,3 +25,20 @@ 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)"
|
||||
|
||||
OUTPUT="$(nvm_ls)"
|
||||
EXPECTED_OUTPUT="v0.0.1
|
||||
v0.0.3
|
||||
v0.0.9
|
||||
iojs-v0.1.2
|
||||
v0.3.1
|
||||
v0.3.3
|
||||
v0.3.9
|
||||
iojs-v0.10.2
|
||||
v0.12.9
|
||||
v0.12.87"
|
||||
if nvm_has_system_node || nvm_has_system_iojs; then
|
||||
EXPECTED_OUTPUT="${EXPECTED_OUTPUT}
|
||||
system"
|
||||
fi
|
||||
[ "${OUTPUT-}" = "${EXPECTED_OUTPUT-}" ] || die "expected >${EXPECTED_OUTPUT}<; got >${OUTPUT}<"
|
||||
|
23
test/fast/Listing versions/Running "nvm ls" with nounset should not fail.
Executable file
23
test/fast/Listing versions/Running "nvm ls" with nounset should not fail.
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../common.sh
|
||||
|
||||
make_fake_node v0.12.34 || die 'fake v0.12.34 could not be made'
|
||||
|
||||
# Enable no unset variable
|
||||
set -u
|
||||
|
||||
# Try an alias that does not exist
|
||||
output=$(nvm ls 99 2>&1 1>/dev/null || true)
|
||||
test -z "${output}" || die "1: expected empty; got >${output}"
|
||||
|
||||
# Try a version that does not exist
|
||||
output=$(nvm ls 0.12.00 2>&1 1>/dev/null || true)
|
||||
test -z "${output}" || die "2: expected empty; got >${output}"
|
||||
|
||||
# Try a version that does exist
|
||||
output=$(nvm ls 0.12.34 2>&1 1>/dev/null || true)
|
||||
test -z "${output}" || die "3: expected empty; got >${output}"
|
@@ -1,17 +1,16 @@
|
||||
rmdir ../../../v0.0.1 >/dev/null 2>&1
|
||||
rmdir ../../../v0.0.2 >/dev/null 2>&1
|
||||
rmdir ../../../v0.0.3 >/dev/null 2>&1
|
||||
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
|
||||
rmdir ../../../v0.3.9 >/dev/null 2>&1
|
||||
rmdir ../../../v0.20.3 >/dev/null 2>&1
|
||||
rmdir ../../../versions >/dev/null 2>&1
|
||||
unalias nvm_has_system_node >/dev/null 2>&1
|
||||
rm -f ../../../alias/stable >/dev/null 2>&1
|
||||
rm -f ../../../alias/unstable >/dev/null 2>&1
|
||||
rm -rf ../../../v0.0.1
|
||||
rm -rf ../../../v0.0.2
|
||||
rm -rf ../../../v0.0.3
|
||||
rm -rf ../../../v0.0.9
|
||||
rm -rf ../../../v0.0.20
|
||||
rm -rf ../../../v0.1.2
|
||||
rm -rf ../../../v0.1.3
|
||||
rm -rf ../../../v0.1.4
|
||||
rm -rf ../../../v0.2.3
|
||||
rm -rf ../../../v0.3.1
|
||||
rm -rf ../../../v0.3.3
|
||||
rm -rf ../../../v0.3.9
|
||||
rm -rf ../../../v0.20.3
|
||||
rm -rf ../../../versions
|
||||
rm -f ../../../alias/stable
|
||||
rm -f ../../../alias/unstable
|
||||
|
@@ -43,7 +43,7 @@ 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
|
||||
# https://github.com/nvm-sh/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
|
||||
|
@@ -46,9 +46,13 @@ WGET_EXPECTED_INFO="$(type wget)"
|
||||
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)"
|
||||
OUTPUT="$(nvm_command_info ls 2>&1 >/dev/null)"
|
||||
[ -z "${OUTPUT}" ] || die "\`nvm_command_info ls\` expected no stderr; got >${OUTPUT}< (stage 4)"
|
||||
OUTPUT="$(nvm_command_info rm 2>&1 >/dev/null)"
|
||||
[ -z "${OUTPUT}" ] || die "\`nvm_command_info rm\` expected no stderr; got >${OUTPUT}< (stage 4)"
|
||||
OUTPUT="$(nvm_command_info git 2>&1 >/dev/null)"
|
||||
[ -z "${OUTPUT}" ] || die "\`nvm_command_info git\` expected no stderr; got >${OUTPUT}< (stage 4)"
|
||||
OUTPUT="$(nvm_command_info grep 2>&1 >/dev/null)"
|
||||
[ -z "${OUTPUT}" ] || die "\`nvm_command_info grep\` expected no stderr; got >${OUTPUT}< (stage 4)"
|
||||
|
||||
cleanup
|
||||
|
91
test/fast/Unit tests/nvm_get_default_packages
Executable file
91
test/fast/Unit tests/nvm_get_default_packages
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
|
||||
FILE="$NVM_DIR/default-packages"
|
||||
\. ../../../nvm.sh
|
||||
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
setup () {
|
||||
if [ -f $FILE ]; then
|
||||
ORIG_DEFAULT_PACKAGES=$(cat $FILE)
|
||||
mkdir -p ./tmp/ ||:
|
||||
mv $FILE ./tmp/default-packages ||:
|
||||
fi
|
||||
touch $FILE
|
||||
}
|
||||
cleanup () {
|
||||
if [ "$ORIG_DEFAULT_PACKAGES" != "" ]; then
|
||||
rm -rf ./tmp/
|
||||
echo "$ORIG_DEFAULT_PACKAGES" > $FILE
|
||||
fi
|
||||
}
|
||||
|
||||
setup
|
||||
|
||||
cat > $FILE << EOF
|
||||
rimraf
|
||||
object-inspect@1.0.2
|
||||
|
||||
# commented-package
|
||||
|
||||
stevemao/left-pad
|
||||
EOF
|
||||
|
||||
DEFAULT_PKGS="$(nvm_get_default_packages)"
|
||||
EXPECTED_PKGS='rimraf object-inspect@1.0.2 stevemao/left-pad'
|
||||
[ "${DEFAULT_PKGS}" = "${EXPECTED_PKGS}" ] || die "1: expected default packages >${EXPECTED_PKGS}<; got >${DEFAULT_PKGS}<"
|
||||
|
||||
cleanup
|
||||
|
||||
setup
|
||||
|
||||
cat > $FILE << EOF
|
||||
rimraf
|
||||
not~a~package~name
|
||||
mkdirp
|
||||
EOF
|
||||
|
||||
DEFAULT_PKGS="$(nvm_get_default_packages)"
|
||||
EXPECTED_PKGS='rimraf not~a~package~name mkdirp'
|
||||
[ "${DEFAULT_PKGS}" = "${EXPECTED_PKGS}" ] || die "2: expected default packages >${EXPECTED_PKGS}<; got >${DEFAULT_PKGS}<"
|
||||
|
||||
cleanup
|
||||
|
||||
setup
|
||||
|
||||
cat > $FILE << EOF
|
||||
rimraf
|
||||
not~a~package~name
|
||||
mkdirp
|
||||
EOF
|
||||
printf %s "$(cat "${FILE}")" > $FILE # strip trailing newline
|
||||
|
||||
DEFAULT_PKGS="$(nvm_get_default_packages)"
|
||||
EXPECTED_PKGS='rimraf not~a~package~name mkdirp'
|
||||
[ "${DEFAULT_PKGS}" = "${EXPECTED_PKGS}" ] || die "3: expected default packages >${EXPECTED_PKGS}<; got >${DEFAULT_PKGS}<"
|
||||
|
||||
cleanup
|
||||
|
||||
setup
|
||||
|
||||
cat > $FILE << EOF
|
||||
object-inspect @ 1.0.2
|
||||
rimraf
|
||||
EOF
|
||||
|
||||
DEFAULT_PKGS="$(nvm_get_default_packages 2>&1 >/dev/null)"
|
||||
EXPECTED_PKGS="Only one package per line is allowed in the $FILE file. Please remove any lines with multiple space-separated values."
|
||||
[ "${DEFAULT_PKGS}" = "${EXPECTED_PKGS}" ] || die "4: expected default packages >${EXPECTED_PKGS}<; got >${DEFAULT_PKGS}<"
|
||||
|
||||
cleanup
|
||||
|
||||
setup
|
||||
|
||||
rm -rf $FILE
|
||||
|
||||
DEFAULT_PKGS="$(nvm_get_default_packages)"
|
||||
EXPECTED_PKGS=''
|
||||
[ "${DEFAULT_PKGS}" = "${EXPECTED_PKGS}" ] || die "5: expected default packages >${EXPECTED_PKGS}<; got >${DEFAULT_PKGS}<"
|
||||
|
||||
touch $FILE
|
||||
|
||||
cleanup
|
32
test/fast/Unit tests/nvm_stdout_is_terminal
Executable file
32
test/fast/Unit tests/nvm_stdout_is_terminal
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
tempfile=$(mktemp)
|
||||
|
||||
die () { echo "$@" ; cleanup; exit 1; }
|
||||
cleanup() { rm -f "$tempfile"; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
if [ -t 1 ] ; then
|
||||
# test is running in a terminal, e.g. locally
|
||||
nvm_stdout_is_terminal || die 'nvm_stdout_is_terminal should be true'
|
||||
nvm_stdout_is_terminal 2>/dev/null || die 'nvm_stdout_is_terminal should be true when stderr is redirected'
|
||||
nvm_stdout_is_terminal </dev/null || die 'nvm_stdout_is_terminal should be true when stdin is redirected'
|
||||
else
|
||||
# test is not running in a terminal, e.g. on travis-ci
|
||||
! nvm_stdout_is_terminal || die 'nvm_stdout_is_terminal should be false'
|
||||
! nvm_stdout_is_terminal 2>/dev/null || die 'nvm_stdout_is_terminal should be false when stderr is redirected'
|
||||
! nvm_stdout_is_terminal </dev/null || die 'nvm_stdout_is_terminal should be false when stdin is redirected'
|
||||
fi
|
||||
|
||||
(! nvm_stdout_is_terminal || echo "boo!") | read && die 'nvm_stdout_is_terminal should be false when stdout goes to a pipe'
|
||||
! nvm_stdout_is_terminal >/dev/null || die 'nvm_stdout_is_terminal should be false when stdout goes to /dev/null'
|
||||
! nvm_stdout_is_terminal >"$tempfile" || die 'nvm_stdout_is_terminal should be false when stdout goes to a file'
|
||||
[ "$(nvm_stdout_is_terminal; echo $?)" = "1" ] || die 'nvm_stdout_is_terminal should be false in command substitution'
|
||||
|
||||
# also test the 'true' case while running on travis-ci or similar environments
|
||||
nvm_stdout_is_terminal >/dev/tty || die 'nvm_stdout_is_terminal should be true when stdout goes to /dev/tty'
|
||||
nvm_stdout_is_terminal >/dev/tty 2>/dev/null || die 'nvm_stdout_is_terminal should be true when stdout goes to /dev/tty and stderr is redirected'
|
||||
nvm_stdout_is_terminal >/dev/tty </dev/null || die 'nvm_stdout_is_terminal should be true when stdout goes to /dev/tty and stdin is redirected'
|
||||
|
||||
cleanup
|
27
test/fast/Unit tests/nvm_supports_source_options
Executable file
27
test/fast/Unit tests/nvm_supports_source_options
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
x=0
|
||||
i=0
|
||||
runs=5
|
||||
calls=500
|
||||
first_result=false
|
||||
if (nvm_supports_source_options && printf .); then
|
||||
first_result=true
|
||||
fi
|
||||
while [ $x -le $runs ]; do
|
||||
y=$x
|
||||
x=$(( x + 1 ))
|
||||
while [ $i -le $calls ]; do
|
||||
this_result=false
|
||||
if (nvm_supports_source_options && printf .); then
|
||||
this_result=true
|
||||
fi
|
||||
[ $this_result = $first_result ] || die "call ${i}, run ${y} got ${this_result}; expected ${first_result}"
|
||||
i=$(( i + 1 ))
|
||||
done
|
||||
done
|
||||
echo "${runs} runs of ${calls} calls succeeded"
|
@@ -9,9 +9,13 @@ NVM_PREFIXED_TEST_VERSION="iojs-$NVM_TEST_VERSION"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ] && rm -R "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}"
|
||||
[ -e "${NVM_DIR}/.cache/bin/${NVM_TEST_VERSION}-linux-x64/" ] && rm -R "${NVM_DIR}/.cache/bin/${NVM_TEST_VERSION}-linux-x64/"
|
||||
|
||||
# Install from binary
|
||||
nvm install $NVM_PREFIXED_TEST_VERSION || die "install $NVM_PREFIXED_TEST_VERSION failed"
|
||||
OUTPUT_HEAD="$(2>&1 nvm install --no-progress $NVM_PREFIXED_TEST_VERSION | tac | tail -n 1)" || die "install $NVM_PREFIXED_TEST_VERSION failed"
|
||||
EXPECTED_OUTPUT_HEAD="Downloading and installing io.js v1.0.0..."
|
||||
|
||||
[ "${OUTPUT_HEAD}" = "${EXPECTED_OUTPUT_HEAD}" ] || die "expected >${EXPECTED_OUTPUT_HEAD}<; got >${OUTPUT_HEAD}<"
|
||||
|
||||
# Check
|
||||
[ -d "${NVM_DIR}/versions/io.js/${NVM_TEST_VERSION}" ]
|
||||
|
@@ -9,11 +9,11 @@ NVM_PREFIXED_TEST_VERSION="$(nvm ls-remote "$NVM_VERSION" | tail -1 | sed 's/^[
|
||||
NVM_TEST_VERSION="$(nvm_strip_iojs_prefix "$NVM_PREFIXED_TEST_VERSION")"
|
||||
|
||||
# Remove the stuff we're clobbering.
|
||||
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
|
||||
[ -e "../../$NVM_TEST_VERSION" ] && rm -R "../../$NVM_TEST_VERSION"
|
||||
|
||||
# Install from binary
|
||||
nvm install "$NVM_VERSION" || die "nvm install $NVM_VERSION failed"
|
||||
|
||||
# Check
|
||||
[ -d "${NVM_DIR}/versions/io.js/$NVM_TEST_VERSION" ]
|
||||
nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
nvm run "$NVM_PREFIXED_TEST_VERSION" --version | grep "$NVM_TEST_VERSION" || die "'nvm run $NVM_PREFIXED_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
|
||||
|
@@ -21,7 +21,7 @@ cleanup () {
|
||||
|
||||
setup
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../nvm.sh
|
||||
|
||||
cat > $FILE << EOF
|
||||
rimraf
|
||||
@@ -30,8 +30,11 @@ object-inspect@1.0.2
|
||||
# commented-package
|
||||
|
||||
stevemao/left-pad
|
||||
daytime
|
||||
EOF
|
||||
|
||||
printf %s "$(cat "${FILE}")" > $FILE # strip trailing newline
|
||||
|
||||
nvm install v6.10.1 2>&1
|
||||
EXIT_CODE=$?
|
||||
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm install v6.10.1' to exit with 0, got $EXIT_CODE"
|
||||
@@ -41,11 +44,16 @@ if [ -z "$?" ]; then
|
||||
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'rimraf'' to exit with 0, got $?"
|
||||
fi
|
||||
|
||||
nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'daytime'
|
||||
if [ -z "$?" ]; then
|
||||
die "expected 'nvm exec v6.10.1 npm ls -g --depth=0 | grep -q 'daytime'' to exit with 0, got $?"
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
||||
setup
|
||||
|
||||
\. ../../../nvm.sh
|
||||
\. ../../nvm.sh
|
||||
|
||||
cat > $FILE << EOF
|
||||
rimraf
|
@@ -20,7 +20,7 @@ nvm ls | grep "$NVM_TEST_VERSION" || die "Failed to install node"
|
||||
# Switch to another version so we can uninstall
|
||||
nvm use 0.12.7
|
||||
|
||||
# if zsh, set "nomatch" opt to reproduce failure from https://github.com/creationix/nvm/issues/1228
|
||||
# if zsh, set "nomatch" opt to reproduce failure from https://github.com/nvm-sh/nvm/issues/1228
|
||||
if nvm_has "setopt"; then
|
||||
setopt nomatch
|
||||
fi
|
||||
|
@@ -19,7 +19,7 @@ nvm ls | grep "$NVM_TEST_VERSION" || die "Failed to install node"
|
||||
|
||||
# Install global module as root
|
||||
npm_path=$(which npm)
|
||||
sudo -n "$npm_path" install jspm -g || die 'either sudo failed, or `npm install jspm -g` failed`'
|
||||
sudo -n "$npm_path" install jspm@'<2' -g || die 'either sudo failed, or `npm install jspm -g` failed`'
|
||||
|
||||
# Switch to another version so we can uninstall
|
||||
nvm use 0.12.7
|
||||
|
@@ -9,7 +9,7 @@ cleanup() {
|
||||
\. ../../../nvm.sh
|
||||
|
||||
EXPECTED_VERSION="v12.3.456"
|
||||
URL="https://github.com/creationix/nvm/releases/tag/$EXPECTED_VERSION"
|
||||
URL="https://github.com/nvm-sh/nvm/releases/tag/$EXPECTED_VERSION"
|
||||
EXPECTED_CURL_ARGS="--compressed -q -w %{url_effective}\n -L -s -S http://latest.nvm.sh -o /dev/null"
|
||||
EXPECTED_WGET_ARGS="-q http://latest.nvm.sh --server-response -O /dev/null"
|
||||
|
||||
@@ -34,7 +34,7 @@ wget() {
|
||||
local WGET_CONTENTS
|
||||
WGET_CONTENTS="
|
||||
HTTP/1.1 301 Moved Permanently
|
||||
Location: https://github.com/creationix/nvm/releases/latest
|
||||
Location: https://github.com/nvm-sh/nvm/releases/latest
|
||||
Content-Type: text/html; charset=utf-8
|
||||
Content-Length: 84
|
||||
Date: Mon, 22 Dec 2014 02:11:15 GMT
|
||||
|
Reference in New Issue
Block a user