Skip to content

Commit dbb65d9

Browse files
authored
Merge pull request #1070 from ljharb/display_lts_remote
[New] Add remote LTS support
2 parents b2c5616 + fb49bf6 commit dbb65d9

33 files changed

+1377
-125
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ alias
77
test/bak
88
.urchin.log
99
.urchin_stdout
10+
test/**/test_output
1011

1112
node_modules/
1213
npm-debug.log

README.markdown

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Note: On OS X, if you have/had a "system" node installed and want to install mod
2828
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with nvm)
2929
- 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/*`
3030

31-
Homebrew installation is not supported.
31+
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.
3232

3333
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_update` to update.
3434

@@ -112,22 +112,22 @@ After upgrading, don't forget to activate the new version:
112112

113113
## Usage
114114

115-
To download, compile, and install the latest v5.0.x release of node, do this:
115+
To download, compile, and install the latest release of node, do this:
116116

117117
```sh
118-
nvm install 5.0
118+
nvm install node
119119
```
120120

121121
And then in any new shell just use the installed version:
122122

123123
```sh
124-
nvm use 5.0
124+
nvm use node
125125
```
126126

127127
Or you can just run it:
128128

129129
```sh
130-
nvm run 5.0 --version
130+
nvm run node --version
131131
```
132132
Or, you can run any arbitrary command in a subshell with the desired version of node:
133133

@@ -148,6 +148,19 @@ In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the f
148148
- `stable`: this alias is deprecated, and only truly applies to `node` `v0.12` and earlier. Currently, this is an alias for `node`.
149149
- `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).
150150

151+
### Long-term support
152+
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:
153+
- `nvm install --lts` / `nvm install --lts=argon`
154+
- `nvm uninstall --lts` / `nvm uninstall --lts=argon`
155+
- `nvm use --lts` / `nvm use --lts=argon`
156+
- `nvm exec --lts` / `nvm exec --lts=argon`
157+
- `nvm run --lts` / `nvm run --lts=argon`
158+
- `nvm ls-remote --lts` / `nvm ls-remote --lts=argon`
159+
- `nvm version-remote --lts` / `nvm version-remote --lts=argon`
160+
161+
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.
162+
163+
### Migrating global packages while installing
151164
If you want to install a new version of Node.js and migrate npm packages from a previous version:
152165

153166
```sh
@@ -159,10 +172,11 @@ This will first use "nvm version node" to identify the current version you're mi
159172
You can also install and migrate npm packages from specific versions of Node like this:
160173

161174
```sh
162-
nvm install v5.0 --reinstall-packages-from=4.2
175+
nvm install 6 --reinstall-packages-from=5
163176
nvm install v4.2 --reinstall-packages-from=iojs
164177
```
165178

179+
### io.js
166180
If you want to install [io.js](https://github.com/iojs/io.js/):
167181

168182
```sh
@@ -177,13 +191,15 @@ nvm install iojs --reinstall-packages-from=iojs
177191

178192
The same guidelines mentioned for migrating npm packages in Node.js are applicable to io.js.
179193

194+
### System version of node
180195
If you want to use the system-installed version of node, you can use the special default alias "system":
181196

182197
```sh
183198
nvm use system
184199
nvm run system --version
185200
```
186201

202+
### Listing versions
187203
If you want to see what versions are installed:
188204

189205
```sh
@@ -217,7 +233,7 @@ nvm install node
217233
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 4.2
218234
```
219235

220-
To use a mirror of the iojs binaries, set `$NVM_IOJS_ORG_MIRROR`:
236+
To use a mirror of the io.js binaries, set `$NVM_IOJS_ORG_MIRROR`:
221237

222238
```sh
223239
export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
@@ -226,7 +242,7 @@ nvm install iojs-v1.0.3
226242
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3
227243
```
228244

229-
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs.
245+
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs. Note that using `nvm` in multiple shell tabs with this environment variable enabled can cause race conditions.
230246

231247
### .nvmrc
232248

@@ -237,6 +253,8 @@ For example, to make nvm default to the latest 5.9 release for the current direc
237253

238254
```sh
239255
$ echo "5.9" > .nvmrc
256+
257+
$ echo "lts/*" > .nvmrc # to default to the latest LTS version
240258
```
241259

242260
Then when you run nvm:
@@ -280,7 +298,7 @@ load-nvmrc
280298
nvm is released under the MIT license.
281299

282300

283-
Copyright (C) 2010-2016 Tim Caswell
301+
Copyright (C) 2010-2016 Tim Caswell and Jordan Harband
284302

285303
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 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
286304

bash_completion

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ __nvm_aliases ()
5757
declare aliases
5858
aliases=""
5959
if [ -d $NVM_DIR/alias ]; then
60-
aliases="`cd $NVM_DIR/alias && command ls`"
60+
aliases="$(cd $NVM_DIR/alias && find $PWD -type f | sed "s:$PWD/::")"
6161
fi
62-
echo "${aliases}"
62+
echo "${aliases} node stable unstable iojs"
6363
}
6464

6565
__nvm_alias ()

0 commit comments

Comments
 (0)