mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-08-20 20:43:43 +00:00
Compare commits
3 Commits
2685f6d5a1
...
58b3d9be3f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
58b3d9be3f | ||
![]() |
6b70c40f15 | ||
![]() |
09c4fcfbed |
@ -100,6 +100,8 @@ nvm is a version manager for [node.js](https://nodejs.org/en/), designed to be i
|
||||
|
||||
### Install & Update Script
|
||||
|
||||
**If you use macOS, you must install Xcode and agree to the Xcode License before you install nvm.**
|
||||
|
||||
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/nvm-sh/nvm/v0.40.1/install.sh | bash
|
||||
@ -108,7 +110,7 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
||||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
||||
```
|
||||
|
||||
Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and attempts to add the source lines from the snippet below to the correct profile file (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`).
|
||||
Running either of the above commands downloads a script and runs it. The script clones the nvm repository to `~/.nvm`, and attempts to add the source lines from the snippet below to the correct profile file (`~/.bash_profile`, `~/.zshrc`, `~/.profile`, or `~/.bashrc`). **If you don't have a profile file in your home dir, you'll need to add the appropriate one before you run the script.**
|
||||
|
||||
<a id="profile_snippet"></a>
|
||||
```sh
|
||||
|
5
nvm.sh
5
nvm.sh
@ -196,6 +196,9 @@ nvm_install_latest_npm() {
|
||||
nvm_echo 'Attempting to upgrade to the latest working version of npm...'
|
||||
local NODE_VERSION
|
||||
NODE_VERSION="$(nvm_strip_iojs_prefix "$(nvm_ls_current)")"
|
||||
local NPM_VERSION
|
||||
NPM_VERSION="$(npm --version 2>/dev/null)"
|
||||
|
||||
if [ "${NODE_VERSION}" = 'system' ]; then
|
||||
NODE_VERSION="$(node --version)"
|
||||
elif [ "${NODE_VERSION}" = 'none' ]; then
|
||||
@ -206,8 +209,6 @@ nvm_install_latest_npm() {
|
||||
nvm_err 'Unable to obtain node version.'
|
||||
return 1
|
||||
fi
|
||||
local NPM_VERSION
|
||||
NPM_VERSION="$(npm --version 2>/dev/null)"
|
||||
if [ -z "${NPM_VERSION}" ]; then
|
||||
nvm_err 'Unable to obtain npm version.'
|
||||
return 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user