Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6669e91bd8 | ||
|
|
7c271729ef | ||
|
|
b54e147442 | ||
|
|
e7e4a9b3d6 | ||
|
|
49e446dac1 | ||
|
|
1b8b7b31ed | ||
|
|
6fc0241c21 | ||
|
|
affcc5087c | ||
|
|
1b2305232f | ||
|
|
f1a5f2a15f |
@@ -1,4 +1,4 @@
|
||||
# Node Version Manager [][3] [][4]
|
||||
# Node Version Manager [][3] [][4] [](https://bestpractices.coreinfrastructure.org/projects/684)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -61,13 +61,13 @@ Homebrew installation is not supported. If you have issues with homebrew-install
|
||||
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.0/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
|
||||
```
|
||||
|
||||
or Wget:
|
||||
|
||||
```sh
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
|
||||
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/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>
|
||||
@@ -322,8 +322,10 @@ load-nvmrc() {
|
||||
if [ -n "$nvmrc_path" ]; then
|
||||
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
||||
|
||||
if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
|
||||
if [ "$nvmrc_node_version" = "N/A" ]; then
|
||||
nvm install
|
||||
elif [ "$nvmrc_node_version" != "$node_version" ]; then
|
||||
nvm use
|
||||
fi
|
||||
elif [ "$node_version" != "$(nvm version default)" ]; then
|
||||
echo "Reverting to nvm default version"
|
||||
@@ -435,7 +437,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
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/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.
|
||||
@@ -466,8 +468,8 @@ After the v0.8.6 release of node, nvm tries to install from binary packages. But
|
||||
If setting the `default` alias does not establish the node version in new shells (i.e. `nvm current` yields `system`), ensure that the system's node PATH is set before the `nvm.sh` source line in your shell profile (see [#658](https://github.com/creationix/nvm/issues/658))
|
||||
|
||||
[1]: https://github.com/creationix/nvm.git
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.33.0/install.sh
|
||||
[2]: https://github.com/creationix/nvm/blob/v0.33.1/install.sh
|
||||
[3]: https://travis-ci.org/creationix/nvm
|
||||
[4]: https://github.com/creationix/nvm/releases/tag/v0.33.0
|
||||
[4]: https://github.com/creationix/nvm/releases/tag/v0.33.1
|
||||
[Urchin]: https://github.com/scraperwiki/urchin
|
||||
[Fish]: http://fishshell.com
|
||||
|
||||
12
install.sh
12
install.sh
@@ -7,11 +7,11 @@ nvm_has() {
|
||||
}
|
||||
|
||||
nvm_install_dir() {
|
||||
echo "${NVM_DIR:-"$HOME/.nvm"}"
|
||||
printf %s "${NVM_DIR:-"$HOME/.nvm"}"
|
||||
}
|
||||
|
||||
nvm_latest_version() {
|
||||
echo "v0.33.0"
|
||||
echo "v0.33.1"
|
||||
}
|
||||
|
||||
#
|
||||
@@ -290,10 +290,10 @@ nvm_do_install() {
|
||||
|
||||
local NVM_PROFILE
|
||||
NVM_PROFILE="$(nvm_detect_profile)"
|
||||
local INSTALL_DIR
|
||||
INSTALL_DIR="$(nvm_install_dir)"
|
||||
local PROFILE_INSTALL_DIR
|
||||
PROFILE_INSTALL_DIR="$(nvm_install_dir| sed "s:^$HOME:\$HOME:")"
|
||||
|
||||
SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
|
||||
SOURCE_STR="\nexport NVM_DIR=\"${PROFILE_INSTALL_DIR}\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
|
||||
COMPLETION_STR="[ -s \"\$NVM_DIR/bash_completion\" ] && \\. \"\$NVM_DIR/bash_completion\" # This loads nvm bash_completion\n"
|
||||
BASH_OR_ZSH=false
|
||||
|
||||
@@ -331,7 +331,7 @@ nvm_do_install() {
|
||||
|
||||
# Source nvm
|
||||
# shellcheck source=/dev/null
|
||||
\. "${INSTALL_DIR}/nvm.sh"
|
||||
\. "$(nvm_install_dir)/nvm.sh"
|
||||
|
||||
nvm_check_global_modules
|
||||
|
||||
|
||||
22
nvm.sh
22
nvm.sh
@@ -47,7 +47,9 @@ nvm_is_alias() {
|
||||
|
||||
nvm_has_colors() {
|
||||
local NVM_COLORS
|
||||
NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
|
||||
if nvm_has tput; then
|
||||
NVM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
|
||||
fi
|
||||
[ "${NVM_COLORS:--1}" -ge 8 ]
|
||||
}
|
||||
|
||||
@@ -2242,6 +2244,8 @@ nvm() {
|
||||
nvm_err "\$NVM_DIR: '$(nvm_sanitize_path "$NVM_DIR")'"
|
||||
nvm_err "\$PREFIX: '$(nvm_sanitize_path "$PREFIX")'"
|
||||
nvm_err "\$NPM_CONFIG_PREFIX: '$(nvm_sanitize_path "$NPM_CONFIG_PREFIX")'"
|
||||
nvm_err "\$NVM_NODEJS_ORG_MIRROR: '${NVM_NODEJS_ORG_MIRROR}'"
|
||||
nvm_err "\$NVM_IOJS_ORG_MIRROR: '${NVM_IOJS_ORG_MIRROR}'"
|
||||
local NVM_DEBUG_OUTPUT
|
||||
for NVM_DEBUG_COMMAND in 'nvm current' 'which node' 'which iojs' 'which npm' 'npm config get prefix' 'npm root -g'
|
||||
do
|
||||
@@ -2316,11 +2320,13 @@ nvm() {
|
||||
nvm_rc_version
|
||||
if [ $version_not_provided -eq 1 ]; then
|
||||
if [ -z "$NVM_RC_VERSION" ]; then
|
||||
unset NVM_RC_VERSION
|
||||
>&2 nvm --help
|
||||
return 127
|
||||
fi
|
||||
fi
|
||||
provided_version="$NVM_RC_VERSION"
|
||||
unset NVM_RC_VERSION
|
||||
fi
|
||||
elif [ $# -gt 0 ]; then
|
||||
shift
|
||||
@@ -2460,7 +2466,11 @@ nvm() {
|
||||
fi
|
||||
|
||||
if [ "$NVM_INSTALL_SUCCESS" = true ] && nvm use "$VERSION"; then
|
||||
nvm_ensure_default_set "$provided_version"
|
||||
if [ -n "${LTS-}" ]; then
|
||||
nvm_ensure_default_set "lts/${LTS}"
|
||||
else
|
||||
nvm_ensure_default_set "$provided_version"
|
||||
fi
|
||||
if [ ! -z "$REINSTALL_PACKAGES_FROM" ] \
|
||||
&& [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
|
||||
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
|
||||
@@ -2613,6 +2623,7 @@ nvm() {
|
||||
PROVIDED_VERSION="$NVM_RC_VERSION"
|
||||
VERSION="$(nvm_version "$PROVIDED_VERSION")"
|
||||
fi
|
||||
unset NVM_RC_VERSION
|
||||
else
|
||||
VERSION="$(nvm_match_version "$PROVIDED_VERSION")"
|
||||
fi
|
||||
@@ -2737,6 +2748,7 @@ nvm() {
|
||||
if [ -n "$NVM_RC_VERSION" ]; then
|
||||
VERSION="$(nvm_version "$NVM_RC_VERSION")" ||:
|
||||
fi
|
||||
unset NVM_RC_VERSION
|
||||
if [ "${VERSION:-N/A}" = 'N/A' ]; then
|
||||
>&2 nvm --help
|
||||
return 127
|
||||
@@ -2757,6 +2769,7 @@ nvm() {
|
||||
fi
|
||||
fi
|
||||
VERSION="$(nvm_version "$NVM_RC_VERSION")" ||:
|
||||
unset NVM_RC_VERSION
|
||||
else
|
||||
shift
|
||||
fi
|
||||
@@ -2832,6 +2845,7 @@ nvm() {
|
||||
nvm_rc_version
|
||||
fi
|
||||
provided_version="$NVM_RC_VERSION"
|
||||
unset NVM_RC_VERSION
|
||||
VERSION="$(nvm_version "$provided_version")" ||:
|
||||
else
|
||||
shift
|
||||
@@ -2947,6 +2961,7 @@ nvm() {
|
||||
provided_version="${NVM_RC_VERSION}"
|
||||
VERSION=$(nvm_version "${NVM_RC_VERSION}") ||:
|
||||
fi
|
||||
unset NVM_RC_VERSION
|
||||
elif [ "_${1}" != '_system' ]; then
|
||||
VERSION="$(nvm_version "${provided_version}")" ||:
|
||||
else
|
||||
@@ -3150,9 +3165,10 @@ nvm() {
|
||||
NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}"
|
||||
;;
|
||||
"--version" )
|
||||
nvm_echo '0.33.0'
|
||||
nvm_echo '0.33.1'
|
||||
;;
|
||||
"unload" )
|
||||
nvm deactivate >/dev/null 2>&1
|
||||
unset -f nvm \
|
||||
nvm_iojs_prefix nvm_node_prefix \
|
||||
nvm_add_iojs_prefix nvm_strip_iojs_prefix \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nvm",
|
||||
"version": "0.33.0",
|
||||
"version": "0.33.1",
|
||||
"description": "Node Version Manager - Simple bash script to manage multiple active node.js versions",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
|
||||
@@ -24,8 +24,6 @@ EXPECTED_OUTPUT="Version '3' (with LTS filter 'argon') not found - try \`nvm ls-
|
||||
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<"
|
||||
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
|
||||
|
||||
set +e # TODO: fix
|
||||
nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed'
|
||||
set -e
|
||||
|
||||
[ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"
|
||||
|
||||
Reference in New Issue
Block a user