Install Node via apk on musl runners instead of nodejs.org's glibc tarball
Same runner dotnet-install.sh detects as musl and picks linux-musl-x64 for -
the glibc node tarball can't even exec there ("env: can't execute 'node'").
This commit is contained in:
@@ -91,6 +91,20 @@ ensure_node() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
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 node_version="22.14.0"
|
||||||
local install_dir="$CI_ROOT/.node"
|
local install_dir="$CI_ROOT/.node"
|
||||||
if [[ ! -x "$install_dir/bin/node" ]]; then
|
if [[ ! -x "$install_dir/bin/node" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user