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