Skip to content

Commit 1eca354

Browse files
maritirenljharb
authored andcommitted
[Docs] Add description if instructions don't work; make install instructions more readable
1 parent 0a4e6f2 commit 1eca354

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

README.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,52 +44,43 @@
4444

4545
### Install & Update script
4646

47-
To **install** or **update** nvm, you can use the [install script][2] using cURL:
48-
47+
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:
4948
```sh
5049
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
5150
```
52-
53-
or Wget:
54-
5551
```sh
5652
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
5753
```
5854

59-
<sub>The script clones the nvm repository to `~/.nvm` and adds the source line to your profile (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).</sub>
60-
61-
<sub>**Note:** If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub>
55+
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`).
6256

57+
<a id="profile_snippet"></a>
6358
```sh
6459
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
6560
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
6661
```
6762

63+
<sub>**Note:** If the environment variable `$XDG_CONFIG_HOME` is present, it will place the `nvm` files there.</sub>
64+
6865
**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.
6966

7067
You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables.
7168
Eg: `curl ... | NVM_DIR="path/to/nvm"`. Ensure that the `NVM_DIR` does not contain a trailing slash.
7269

7370
<sub>*NB. The installer can use `git`, `curl`, or `wget` to download `nvm`, whatever is available.*</sub>
7471

75-
**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:
76-
77-
```sh
78-
command -v nvm
79-
```
80-
81-
simply close your current terminal, open a new terminal, and try verifying again.
72+
**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.
8273

8374
**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))
8475

85-
**Note:** On OS X, if you get `nvm: command not found` after running the install script, one of the following might be the reason:-
86-
87-
- 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
88-
- you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.
76+
**Note:** On OS X, if you get `nvm: command not found` after running the install script, one of the following might be the reason:
8977

90-
If the above doesn't fix the problem, open your `.bash_profile` and add the following line of code:
78+
- 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
79+
- You might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.
9180

92-
`source ~/.bashrc`
81+
If the above doesn't fix the problem, you may try the following:
82+
- 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`.
83+
- 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`).
9384

9485
- For more information about this issue and possible workarounds, please [refer here](https://github.com/nvm-sh/nvm/issues/576)
9586

0 commit comments

Comments
 (0)