fix: use npm exec as primary yarn method (bypasses corepack proxy hang)
This commit is contained in:
1 parent
9a939844cb
commit
9cf14dc1d2
1 file changed
+10
-35
+10
-35
@@ -1993,52 +1993,27 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
|
||||
if yarn_bin:
|
||||
try:
|
||||
result = subprocess.run([yarn_bin, "--version"], capture_output=True, text=True, timeout=3)
|
||||
if DEBUG:
|
||||
print(f" debug pick: yarn_bin={yarn_bin}, version={result.stdout.strip()}")
|
||||
major = _get_yarn_major_version(["yarn"])
|
||||
if result.stdout.strip():
|
||||
major = _get_yarn_major_version(["yarn"])
|
||||
if DEBUG:
|
||||
print(f" debug pick: yarn_bin={yarn_bin}, version={result.stdout.strip()}")
|
||||
if major and major >= 4:
|
||||
return ["yarn"]
|
||||
except (subprocess.TimeoutExpired, Exception):
|
||||
if DEBUG:
|
||||
print(f" debug pick: yarn_bin={yarn_bin} HANGS, removing...")
|
||||
try:
|
||||
subprocess.run(["rm", "-f", yarn_bin], check=False)
|
||||
major = None
|
||||
except Exception:
|
||||
major = None
|
||||
if major and major >= 4:
|
||||
return ["yarn"]
|
||||
elif major:
|
||||
if DEBUG:
|
||||
print(f" Found Yarn {major}.x but need 4.x+")
|
||||
print(f" debug pick: yarn_bin={yarn_bin} HANGS, skipping")
|
||||
|
||||
# Check yarnpkg
|
||||
if shutil.which("yarnpkg"):
|
||||
major = _get_yarn_major_version(["yarnpkg"])
|
||||
if major and major >= 4:
|
||||
return ["yarnpkg"]
|
||||
elif major:
|
||||
if DEBUG:
|
||||
print(f" Found yarnpkg {major}.x but need 4.x+")
|
||||
|
||||
# Fallback to npm exec
|
||||
# Use npm exec directly (bypasses broken corepack proxy)
|
||||
if shutil.which("npm"):
|
||||
try:
|
||||
major = _get_yarn_major_version(["npm", "exec", "--yes", "yarn@stable", "--"])
|
||||
if major and major >= 4:
|
||||
if DEBUG:
|
||||
print(f" debug pick: using npm exec for yarn")
|
||||
return ["npm", "exec", "--yes", "yarn@stable", "--"]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback to npx
|
||||
if shutil.which("npx"):
|
||||
try:
|
||||
major = _get_yarn_major_version(["npx", "-y", "yarn@stable"])
|
||||
if major and major >= 4:
|
||||
return ["npx", "-y", "yarn@stable"]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
def _cleanup_yarn_artifacts():
|
||||
"""Remove corrupted yarn artifacts."""
|
||||
# Do NOT remove .yarnrc.yml - it configures Yarn 4.x mode
|
||||
|
||||
Reference in new issue
Block a user