fix: fix the state.json creation path when execute pnpm patch in sub package (#9733)

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
xiaoliyooo
2025-09-20 08:51:23 +08:00
committed by GitHub
parent c9b6b40117
commit 6633eb3eb0
3 changed files with 8 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ export async function handler (opts: PatchCommitCommandOptions, params: string[]
const editDir = path.resolve(opts.dir, userDir)
const stateValue = readEditDirState({
editDir,
modulesDir: path.join(opts.dir, opts.modulesDir ?? 'node_modules'),
modulesDir: path.join(lockfileDir, opts.modulesDir ?? 'node_modules'),
})
if (!stateValue) {
throw new PnpmError('INVALID_PATCH_DIR', `${userDir} is not a valid patch directory`, {