fix(core): don't try to read the name prop of manifest that is null

This commit is contained in:
Zoltan Kochan
2022-01-25 16:38:30 +02:00
parent 4a555464b5
commit c1383044d1
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/core": patch
---
Fixed an exception that was caused by reading the name property from a manifest that was not defined.

View File

@@ -873,10 +873,14 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
await Promise.all(
directPkgs.map(async (dep) => {
const manifest = await dep.fetchingBundledManifest?.() ?? await safeReadProjectManifestOnly(dep.dir)
let nodeExecPath: string | undefined
if (manifest?.name) {
nodeExecPath = project.manifest.dependenciesMeta?.[manifest.name]?.node
}
return {
location: dep.dir,
manifest,
nodeExecPath: project.manifest.dependenciesMeta?.[manifest!.name!]?.node,
nodeExecPath,
}
})
)