-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodejs.sh
More file actions
executable file
·29 lines (20 loc) · 833 Bytes
/
nodejs.sh
File metadata and controls
executable file
·29 lines (20 loc) · 833 Bytes
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
#!/bin/sh
# Install Node.js
# Don't exit immediately if a command exits with a non-zero status
# This causes the script to stop after executing `nvm.sh`
# set -e
# Update the user's cached credentials, authenticating the user if necessary
sudo -v
# Store a local variable of the scripts current directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "==> Installing Node Version Manager..."
# Install Node Version Manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
# Allow NVM without restarting
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
echo "==> Node Version Manager installed."
# Install latest Node.js with NVM
echo "==> Installing latest Node.js LTS..."
nvm install --lts
echo "==> Latest Node.js LTS installed."