fix: clean Yarn 4.x PnP files before yarn install
PnP files (.pnp.cjs, .pnp.d.ts, .pnp.loader.mjs) can cause stale typescript patch resolution errors (ENOENT _tsc.js). Clean them before yarn install and before retry.
This commit is contained in:
1 parent
7cf0a6f475
commit
56e16c3996
2 files changed
+16
No files matched your search
@@ -2312,6 +2312,12 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
|
||||
os.chdir(src_frontend)
|
||||
_prepare_sass(src_frontend)
|
||||
|
||||
# Clean Yarn 4.x PnP files that can cause stale patch resolution
|
||||
for pnp_file in [".pnp.cjs", ".pnp.d.ts", ".pnp.loader.mjs"]:
|
||||
p = src_frontend / pnp_file
|
||||
if p.exists():
|
||||
p.unlink()
|
||||
|
||||
shutil.rmtree(src_frontend / ".yarn", ignore_errors=True)
|
||||
shutil.rmtree(src_frontend / "node_modules", ignore_errors=True)
|
||||
run(yarn_cmd + ["cache", "clean", "--all"], check=False)
|
||||
@@ -2344,6 +2350,10 @@ def _build_frontend(src_frontend: Path, dest_frontend: Path):
|
||||
node_modules = src_frontend / "node_modules"
|
||||
if node_modules.exists():
|
||||
shutil.rmtree(node_modules, ignore_errors=True)
|
||||
for pnp_file in [".pnp.cjs", ".pnp.d.ts", ".pnp.loader.mjs"]:
|
||||
p = src_frontend / pnp_file
|
||||
if p.exists():
|
||||
p.unlink()
|
||||
run(install_cmd, timeout=1200)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user