mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-30 04:52:04 -04:00
fix: do not throw MISSING_HOISTED_LOCATIONS for optional packages (#6553)
* do not throw MISSING_HOISTED_LOCATIONS for optional packages * docs: add changesets --------- Co-authored-by: Douglas Ward <douglas@giantmonkey.de> Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
6
.changeset/kind-windows-reflect.md
Normal file
6
.changeset/kind-windows-reflect.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-rebuild": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
`pnpm rebuild` should not fail when `node-linker` is set to `hoisted` and there are skipped optional dependencies [#6553](https://github.com/pnpm/pnpm/pull/6553).
|
||||
@@ -281,6 +281,7 @@ async function _rebuild (
|
||||
? (ctx.modulesFile?.hoistedLocations?.[depPath] ?? []).map((hoistedLocation) => path.join(opts.lockfileDir, hoistedLocation))
|
||||
: [path.join(ctx.virtualStoreDir, dp.depPathToFilename(depPath), 'node_modules', pkgInfo.name)]
|
||||
if (pkgRoots.length === 0) {
|
||||
if (pkgSnapshot.optional) return
|
||||
throw new PnpmError('MISSING_HOISTED_LOCATIONS', `${depPath} is not found in hoistedLocations inside node_modules/.modules.yaml`, {
|
||||
hint: 'If you installed your node_modules with pnpm older than v7.19.0, you may need to remove it and run "pnpm install"',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user