Add script to install current node version

The API is conveniently exactly the same as rbenv.
This commit is contained in:
David Cook
2023-02-17 10:17:48 +11:00
parent e3fa933699
commit b7a3f7263b

15
script/nodenv-install.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
#
# Install our selected Node version defined in the .node-version file.
#
# If our node-build version is outdated and it can't build the version we want
# then we try upgrading node-build and installing again.
if nodenv install --skip-existing; then
echo "Correct Node version is installed."
else
echo "Upgrading node-build:"
git -C "$(nodenv root)"/plugins/node-build pull
nodenv install
fi