mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
astro/cli/install-package.ts: whichPm may return null if ran in an empty directory (#10782)
This commit is contained in:
parent
af1af9faee
commit
b0589d0553
2 changed files with 6 additions and 1 deletions
5
.changeset/many-hairs-jump.md
Normal file
5
.changeset/many-hairs-jump.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Handles possible null value when calling `which-pm` during dynamic package installation
|
|
@ -101,7 +101,7 @@ async function installPackage(
|
|||
logger: Logger
|
||||
): Promise<boolean> {
|
||||
const cwd = options.cwd ?? process.cwd();
|
||||
const packageManager = (await whichPm(cwd)).name ?? 'npm';
|
||||
const packageManager = (await whichPm(cwd))?.name ?? 'npm';
|
||||
const installCommand = getInstallCommand(packageNames, packageManager);
|
||||
|
||||
if (!installCommand) {
|
||||
|
|
Loading…
Reference in a new issue