diff --git a/scripts/ci/lib.sh b/scripts/ci/lib.sh index e0c98d6..14f1337 100755 --- a/scripts/ci/lib.sh +++ b/scripts/ci/lib.sh @@ -91,6 +91,20 @@ ensure_node() { return 0 fi + # nodejs.org only ships glibc binaries; on a musl/Alpine runner (same one + # dotnet-install.sh detects and picks the linux-musl-x64 SDK for) that + # tarball fails to exec at all ("env: can't execute 'node'"). Prefer the + # distro's own package on musl instead of a broken glibc download. + if [[ ! -x "$CI_ROOT/.node/bin/node" ]] && command -v apk > /dev/null 2>&1; then + log "node not found on PATH; installing via apk (musl runner)" + local sudo_cmd="" + if [[ "$(id -u)" -ne 0 ]] && command -v sudo > /dev/null 2>&1; then + sudo_cmd="sudo" + fi + $sudo_cmd apk add --no-cache nodejs npm + return 0 + fi + local node_version="22.14.0" local install_dir="$CI_ROOT/.node" if [[ ! -x "$install_dir/bin/node" ]]; then