Skip to content

Commit f1da20a

Browse files
committed
fixed hard crash.
1 parent b9ee271 commit f1da20a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/install.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
set -euo pipefail
66

7+
if [ -z "${HOME:-}" ]; then
8+
printf '\nERROR: HOME is not set. Set it to your home directory and re-run this script.\n\n' >&2
9+
exit 1
10+
fi
11+
712
NVM_VERSION="${NVM_VERSION:-v0.40.3}"
813

914
error() {
@@ -70,10 +75,13 @@ install_node_via_nvm() {
7075
}
7176

7277
ensure_node() {
73-
if require_cmd node; then
74-
info "Node.js is already installed: $(command -v node) ($(node --version))"
78+
if require_cmd node && require_cmd npm && require_cmd corepack; then
79+
info "Node.js is already installed: $(command -v node) ($(node --version)), npm $(npm --version)"
7580
return 0
7681
fi
82+
if require_cmd node; then
83+
error "Node.js is on PATH but this installer also requires npm and Corepack (corepack). Install a full Node.js toolchain, then re-run."
84+
fi
7785
install_node_via_nvm
7886
}
7987

0 commit comments

Comments
 (0)