From 2608f847b69846823ba52e949e9780012fdd81ea Mon Sep 17 00:00:00 2001 From: Kallum Jones Date: Tue, 9 Aug 2022 18:25:02 +0100 Subject: [PATCH] Added check that node is available on root path --- install.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 6bf14c5..a1042b0 100644 --- a/install.sh +++ b/install.sh @@ -36,7 +36,15 @@ mkdir -p "$DOWNLOAD_DIR" # Verify compatible version of node is installed info "Verifying node verison..." -NODE_VERSION=$( (node --version | sed 's/\..*//') | sed "s/v//") +NODE_VERSION_STR=$(node --version) +if [[ "$?" -eq 127 ]] +then + error "Node either is not installed, or is not on the root path.\n If you installed Node using NVM, see this link, ensuring links are made for node, npm and npx: https://stackoverflow.com/questions/21215059/cant-use-nvm-from-root-or-sudo" + exit +fi + + +NODE_VERSION=$( (echo $NODE_VERSION_STR | sed 's/\..*//') | sed "s/v//") if [[ "$NODE_VERSION" -ge "$MIN_NODE_VERSION" ]] then success "A version of node greater than $MIN_NODE_VERSION is installed!"