fix: use corepack yarn directly in _pick_yarn_cmd

This commit is contained in:
iamninja committed 2026-10-05 16:53:23 +05:00
1 parent eeeca44e4a
commit 4b2d79e62f
1 file changed
+10 -11
+10 -11
View File
@@ -2003,23 +2003,22 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
if DEBUG:
print(f" debug pick: yarn_bin={yarn_bin} HANGS, skipping")
# Use npm exec directly (bypasses broken corepack proxy)
if shutil.which("npm"):
# Use corepack yarn directly (bypasses broken corepack proxy)
if shutil.which("corepack") and shutil.which("npm"):
try:
result = subprocess.run(
["npm", "exec", "--yes", "yarn@stable", "--", "--version"],
capture_output=True, text=True, timeout=30,
["corepack", "yarn", "--version"],
capture_output=True, text=True, timeout=15,
)
if DEBUG:
print(f" debug pick: npm exec version={result.stdout.strip()} rc={result.returncode}")
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", "--"]
print(f" debug pick: corepack yarn version={result.stdout.strip()} rc={result.returncode}")
if result.returncode == 0:
match = re.match(r'^(\d+)', result.stdout.strip())
if match and int(match.group(1)) >= 4:
return ["corepack", "yarn"]
except Exception as e:
if DEBUG:
print(f" debug pick: npm exec failed: {e}")
print(f" debug pick: corepack yarn failed: {e}")
pass
return None