Skip to content

Commit fd41264

Browse files
justindhillonljharb
authored andcommitted
[readme] add section on bare nvm install
1 parent 2426a0c commit fd41264

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,27 @@ $ echo "node" > .nvmrc # to default to the latest version
542542

543543
[NB these examples assume a POSIX-compliant shell version of `echo`. If you use a Windows `cmd` development environment, eg the `.nvmrc` file is used to configure a remote Linux deployment, then keep in mind the `"`s will be copied leading to an invalid file. Remove them.]
544544

545-
Then when you run nvm:
545+
Then when you run nvm use:
546546

547547
```sh
548548
$ nvm use
549549
Found '/path/to/project/.nvmrc' with version <5.9>
550550
Now using node v5.9.1 (npm v3.7.3)
551551
```
552552

553+
Running nvm install will also switch over to the correct version, but if the correct node version isn't already installed, it will install it for you.
554+
555+
```sh
556+
$ nvm install
557+
Found '/path/to/project/.nvmrc' with version <5.9>
558+
Downloading and installing node v5.9.1...
559+
Downloading https://nodejs.org/dist/v5.9.1/node-v5.9.1-linux-x64.tar.xz...
560+
#################################################################################### 100.0%
561+
Computing checksum with sha256sum
562+
Checksums matched!
563+
Now using node v5.9.1 (npm v3.7.3)
564+
```
565+
553566
`nvm use` et. al. will traverse directory structure upwards from the current directory looking for the `.nvmrc` file. In other words, running `nvm use` et. al. in any subdirectory of a directory with an `.nvmrc` will result in that `.nvmrc` being utilized.
554567

555568
The contents of a `.nvmrc` file **must** be the `<version>` (as described by `nvm --help`) followed by a newline. No trailing spaces are allowed, and the trailing newline is required.

0 commit comments

Comments
 (0)