2024-06-04 17:02:54 -05:00
|
|
|
if ! command -v nodenv &>/dev/null; then
|
2024-06-05 19:29:52 -05:00
|
|
|
URL="https://nodejs.org/download/release/index.json"
|
2024-06-05 19:25:30 -05:00
|
|
|
DEFAULT_NODE_VERSION=$(curl -s "$URL" | jq -r '.[] | select(.lts != false) | .version' | head -n 1)
|
2024-05-26 20:43:15 -05:00
|
|
|
|
2024-05-26 18:09:34 -05:00
|
|
|
git clone https://github.com/nodenv/nodenv.git ~/.nodenv
|
|
|
|
sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv
|
|
|
|
cd ~/.nodenv
|
|
|
|
src/configure && make -C src || true
|
|
|
|
cd ~/
|
|
|
|
mkdir -p "$(nodenv root)"/plugins
|
|
|
|
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
|
|
|
|
git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases
|
2024-05-26 20:43:15 -05:00
|
|
|
nodenv install $DEFAULT_NODE_VERSION
|
|
|
|
nodenv global $DEFAULT_NODE_VERSION
|
2024-05-26 18:09:34 -05:00
|
|
|
sudo ln -vs $(nodenv root)/shims/* /usr/local/bin/
|
|
|
|
fi
|