Skip to content

Commit 2d80e1c

Browse files
authored
Merge branch 'main' into docs/fix-migration-doc-anchors
2 parents c32eda8 + 543a054 commit 2d80e1c

2 files changed

Lines changed: 50 additions & 10 deletions

File tree

packages/cli/install.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,23 @@ function Main {
316316
} | ConvertTo-Json -Depth 10
317317
Set-Content -Path (Join-Path $VersionDir "package.json") -Value $wrapperJson
318318

319+
# Isolate from user's global package manager config that may block
320+
# installing recently-published packages (e.g. pnpm's minimumReleaseAge,
321+
# npm's min-release-age) by creating a local .npmrc in the version directory.
322+
Set-Content -Path (Join-Path $VersionDir ".npmrc") -Value "minimum-release-age=0`nmin-release-age=0"
323+
319324
# Install production dependencies (skip if VITE_PLUS_SKIP_DEPS_INSTALL is set,
320325
# e.g. during local dev where install-global-cli.ts handles deps separately)
321326
if (-not $env:VITE_PLUS_SKIP_DEPS_INSTALL) {
327+
$installLog = Join-Path $VersionDir "install.log"
322328
Push-Location $VersionDir
323329
try {
324330
$env:CI = "true"
325-
& "$BinDir\vp.exe" install --silent
331+
& "$BinDir\vp.exe" install --silent *> $installLog
332+
if ($LASTEXITCODE -ne 0) {
333+
Write-Host "error: Failed to install dependencies. See log for details: $installLog" -ForegroundColor Red
334+
exit 1
335+
}
326336
} finally {
327337
Pop-Location
328338
}

packages/cli/install.sh

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,40 @@ curl_with_error_handling() {
141141

142142
# Detect libc type on Linux (gnu or musl)
143143
detect_libc() {
144-
# Check for musl dynamic linker (most reliable method)
145-
if [ -e /lib/ld-musl-x86_64.so.1 ] || [ -e /lib/ld-musl-aarch64.so.1 ]; then
146-
echo "musl"
147-
return
144+
# Prefer positive glibc detection first.
145+
# This avoids false musl detection on systems where musl is installed
146+
# but the distro itself is glibc-based (common on WSL/Ubuntu).
147+
if command -v getconf &> /dev/null; then
148+
if getconf GNU_LIBC_VERSION > /dev/null 2>&1; then
149+
echo "gnu"
150+
return
151+
fi
148152
fi
149153

150-
# Check if ldd exists and is musl-based
154+
# Check ldd output for musl/glibc
151155
if command -v ldd &> /dev/null; then
152-
if ldd --version 2>&1 | grep -qi musl; then
156+
ldd_out="$(ldd --version 2>&1 || true)"
157+
if echo "$ldd_out" | grep -qi musl; then
153158
echo "musl"
154159
return
155160
fi
161+
if echo "$ldd_out" | grep -qi 'gnu libc'; then
162+
echo "gnu"
163+
return
164+
fi
165+
if echo "$ldd_out" | grep -qi 'glibc'; then
166+
echo "gnu"
167+
return
168+
fi
156169
fi
157170

158-
# Default to gnu (glibc)
159-
echo "gnu"
171+
# Final fallback: musl loader present usually indicates musl-based distro,
172+
# but only check this after glibc detection to avoid false positives.
173+
if [ -e /lib/ld-musl-x86_64.so.1 ] || [ -e /lib/ld-musl-aarch64.so.1 ]; then
174+
echo "musl"
175+
else
176+
echo "gnu"
177+
fi
160178
}
161179

162180
# Detect platform
@@ -574,10 +592,22 @@ main() {
574592
}
575593
WRAPPER_EOF
576594

595+
# Isolate from user's global package manager config that may block
596+
# installing recently-published packages (e.g. pnpm's minimumReleaseAge,
597+
# npm's min-release-age) by creating a local .npmrc in the version directory.
598+
cat > "$VERSION_DIR/.npmrc" <<NPMRC_EOF
599+
minimum-release-age=0
600+
min-release-age=0
601+
NPMRC_EOF
602+
577603
# Install production dependencies (skip if VITE_PLUS_SKIP_DEPS_INSTALL is set,
578604
# e.g. during local dev where install-global-cli.ts handles deps separately)
579605
if [ -z "${VITE_PLUS_SKIP_DEPS_INSTALL:-}" ]; then
580-
(cd "$VERSION_DIR" && CI=true "$BIN_DIR/vp" install --silent)
606+
local install_log="$VERSION_DIR/install.log"
607+
if ! (cd "$VERSION_DIR" && CI=true "$BIN_DIR/vp" install --silent > "$install_log" 2>&1); then
608+
error "Failed to install dependencies. See log for details: $install_log"
609+
exit 1
610+
fi
581611
fi
582612

583613
# Create/update current symlink (use relative path for portability)

0 commit comments

Comments
 (0)