@@ -141,22 +141,40 @@ curl_with_error_handling() {
141141
142142# Detect libc type on Linux (gnu or musl)
143143detect_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}
575593WRAPPER_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