-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodejs_setup.txt
55 lines (36 loc) · 2.02 KB
/
nodejs_setup.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Download the install script
# Using curl, or wget, download the installation script. In the URL below make sure you replace v12.0.0 with the latest version of nvm.
=> curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh -o install_nvm.sh
# Run the install script with bash.
=> bash install_nvm.sh
# This script clones the nvm repository into ~/.nvm. Then it updates your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc) to source the nvm.sh it contains.
# You can confirm that your profile is updated by looking at the install script's output to determine which file it used. Look for something like the following in that file:
=> export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#Restart your terminal
#In order to pick up the changes to your profile either close and reopen the terminal, or manually source your respective ~/.profile.
#Example:
=> source ~/.bash_profile
#Verify it worked
#Finally, you can verify that it's installed with the command command:
=> command -v nvm
# See what it does
# Finally, run the nvm command to get a list of all the available sub-commands and to further verify that installation worked.
# Use nvm to install the latest LTS release of Node.js
# Now that you've got nvm installed let's use it to install, and use, the current LTS version of Node.js.
=> nvm install --lts
# Output
# Installing latest LTS version.
# Downloading and installing node v10.16.3...
# Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-darwin-x64.tar.xz...
######################################################################## 100.0%
# Computing checksum with sha256sum
# Checksums matched!
# Now using node v10.16.3 (npm v6.9.0)
# Creating default alias: default -> lts/* (-> v10.16.3)
#Verify it worked, and that the version is correct:
=> node --version
# v10.16.3
# which node
# /Users/joe/.nvm/versions/node/v10.16.3/bin/node