fix: uninstall yarn 1.x before corepack prepare and fix corepack indent

This commit is contained in:
iamninja committed 2026-10-05 15:29:45 +05:00
1 parent 2b92e7b6d6
commit bcdcc09cce
1 file changed
+10 -7
+10 -7
View File
@@ -2173,6 +2173,9 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
# METHOD 1: Corepack (recommended for Yarn 4.x)
if shutil.which("corepack"):
try:
# Uninstall old yarn 1.x to prevent conflicts
subprocess.run(["npm", "uninstall", "-g", "yarn"], check=False, cwd="/tmp")
# Enable corepack
subprocess.run(
["corepack", "enable"],
@@ -2201,13 +2204,13 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
# Check version
if shutil.which("yarn"):
major = _get_yarn_major_version(["yarn"])
if major and major >= 4:
if DEBUG:
print(f" ✓ Yarn {major}.x installed via corepack")
os.chdir(original_cwd)
return True
major = _get_yarn_major_version(["yarn"])
if major and major >= 4:
if DEBUG:
print(f" ✓ Yarn {major}.x installed via corepack")
os.chdir(original_cwd)
return True
except Exception as e:
if DEBUG:
print(f" ⚠ Corepack method failed: {e}")