Files
openfoodnetwork/script/nodenv-install.sh
David Cook d377300f32 Support installations with homebrew (macOS)
The officially recommended installation for Mac is via Homebrew.
2023-02-17 10:36:10 +11:00

17 lines
530 B
Bash
Executable File

#!/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:"
# If homebrew (macOS) installed, try that first. Otherwise look in plugins directory.
brew upgrade node-build || git -C "$(nodenv root)"/plugins/node-build pull
nodenv install
fi