Check npm is installed

This commit is contained in:
Kallum Jones 2022-08-09 18:58:20 +01:00
parent 2010b8dec9
commit f26324d4f5
No known key found for this signature in database
GPG Key ID: D7F4589C4D7F81A9

View File

@ -36,13 +36,20 @@ mkdir -p "$DOWNLOAD_DIR" || exit
# Verify compatible version of node is installed # Verify compatible version of node is installed
info "Verifying node verison..." info "Verifying node verison..."
NODE_VERSION_STR=$(node --version) || exit NODE_VERSION_STR=$(node --version)
if [[ "$?" -eq 127 ]] if [[ "$?" -eq 127 ]]
then then
error "Node does not appear to be installed. Please install Node version $MIN_NODE_VERSION or higher" error "Node does not appear to be installed. Please install Node version $MIN_NODE_VERSION or higher"
exit exit
fi fi
npm --version
if [[ "$?" -eq 127 ]]
then
error "Npm does not appear to be installed. Please install npm and re run the installer"
exit
fi
NODE_VERSION=$( (echo $NODE_VERSION_STR | sed 's/\..*//') | sed "s/v//") NODE_VERSION=$( (echo $NODE_VERSION_STR | sed 's/\..*//') | sed "s/v//")
if [[ "$NODE_VERSION" -ge "$MIN_NODE_VERSION" ]] if [[ "$NODE_VERSION" -ge "$MIN_NODE_VERSION" ]]