Skip to content

Commit d1e73f9

Browse files
committed
Fix readPackageJson stack overflow by reading file directly for cache check
1 parent b8c65e0 commit d1e73f9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/install-npm-packages.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ async function installPackage(packageInfo) {
103103
// Check if installation is complete and valid.
104104
if (existsSync(installMarkerPath) && existsSync(packageJsonPath)) {
105105
try {
106-
// Read non-editable version for checking to avoid circular reference issues.
107-
const existingPkgJson = await readPackageJson(installedPath, {
108-
normalize: true,
109-
})
106+
// Read package.json directly to avoid readPackageJson issues with circular references.
107+
const existingPkgJson = JSON.parse(
108+
await fs.readFile(packageJsonPath, 'utf8'),
109+
)
110110
const markerData = JSON.parse(
111111
await fs.readFile(installMarkerPath, 'utf8'),
112112
)

0 commit comments

Comments
 (0)