-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_node.sh
More file actions
executable file
·32 lines (24 loc) · 868 Bytes
/
install_node.sh
File metadata and controls
executable file
·32 lines (24 loc) · 868 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
30
31
#!/bin/bash
set -e
if [ ! -d "${HOME}/.nvm" ]; then
echo "[info] Installing nvm ..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
fi
export NVM_DIR="${HOME}/.nvm"
source "${NVM_DIR}/nvm.sh"
if ! grep -sq 'nvm' "${HOME}/.bash_post"; then
echo "[info] Adding nvm configuration to .bash_post"
cat <<- 'EOF' >> "${HOME}/.bash_post"
# ============================================================================
# nvm
# ============================================================================
export NVM_DIR="${HOME}/.nvm"
[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh"
EOF
fi
echo "[info] Installing nodejs lts/jod = 22 with nvm ..."
nvm install lts/jod
echo "[info] Installing nodejs lts/iron = 20 with nvm ..."
nvm install lts/iron
echo "[info] setting nodejs 22 as default ..."
nvm alias default lts/jod