Skip to content

Commit

Permalink
do not throw MISSING_HOISTED_LOCATIONS for optional packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Ward committed May 16, 2023
1 parent cdb2a93 commit d5a58c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions exec/plugin-commands-rebuild/src/implementation/index.ts
Expand Up @@ -281,9 +281,13 @@ 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) {
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"',
})
if (pkgSnapshot.optional) {
return
} else {
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"',
})
}
}
const pkgRoot = pkgRoots[0]
try {
Expand Down

0 comments on commit d5a58c2

Please sign in to comment.