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
+7
-32
+7
-32
@@ -1993,52 +1993,27 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
|
|||||||
if yarn_bin:
|
if yarn_bin:
|
||||||
try:
|
try:
|
||||||
result = subprocess.run([yarn_bin, "--version"], capture_output=True, text=True, timeout=3)
|
result = subprocess.run([yarn_bin, "--version"], capture_output=True, text=True, timeout=3)
|
||||||
|
if result.stdout.strip():
|
||||||
|
major = _get_yarn_major_version(["yarn"])
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f" debug pick: yarn_bin={yarn_bin}, version={result.stdout.strip()}")
|
print(f" debug pick: yarn_bin={yarn_bin}, version={result.stdout.strip()}")
|
||||||
major = _get_yarn_major_version(["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:
|
if major and major >= 4:
|
||||||
return ["yarn"]
|
return ["yarn"]
|
||||||
elif major:
|
except (subprocess.TimeoutExpired, Exception):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(f" Found Yarn {major}.x but need 4.x+")
|
print(f" debug pick: yarn_bin={yarn_bin} HANGS, skipping")
|
||||||
|
|
||||||
# Check yarnpkg
|
# Use npm exec directly (bypasses broken corepack proxy)
|
||||||
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
|
|
||||||
if shutil.which("npm"):
|
if shutil.which("npm"):
|
||||||
try:
|
try:
|
||||||
major = _get_yarn_major_version(["npm", "exec", "--yes", "yarn@stable", "--"])
|
major = _get_yarn_major_version(["npm", "exec", "--yes", "yarn@stable", "--"])
|
||||||
if major and major >= 4:
|
if major and major >= 4:
|
||||||
|
if DEBUG:
|
||||||
|
print(f" debug pick: using npm exec for yarn")
|
||||||
return ["npm", "exec", "--yes", "yarn@stable", "--"]
|
return ["npm", "exec", "--yes", "yarn@stable", "--"]
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
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():
|
def _cleanup_yarn_artifacts():
|
||||||
"""Remove corrupted yarn artifacts."""
|
"""Remove corrupted yarn artifacts."""
|
||||||
# Do NOT remove .yarnrc.yml - it configures Yarn 4.x mode
|
# Do NOT remove .yarnrc.yml - it configures Yarn 4.x mode
|
||||||
|
|||||||
Reference in new issue
Block a user