From 4b2d79e62fa7f573ec5b1143879f853d47b9d41f Mon Sep 17 00:00:00 2001 From: Sergey Bahmatov Date: Mon, 5 Oct 2026 16:53:23 +0500 Subject: [PATCH] fix: use corepack yarn directly in _pick_yarn_cmd --- npm_install.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/npm_install.py b/npm_install.py index 853b764..a46f68f 100644 --- a/npm_install.py +++ b/npm_install.py @@ -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