From 0fa483283e54c94f173838cd558dc0dbdd11e699 Mon Sep 17 00:00:00 2001 From: Mohammed Elhaouari Date: Thu, 7 Sep 2023 09:39:42 +0100 Subject: [PATCH] Fix "Cannot read properties of null" in cli/telemetry (#8443) Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> --- .changeset/strong-colts-hang.md | 5 +++++ packages/astro/src/cli/telemetry/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/strong-colts-hang.md diff --git a/.changeset/strong-colts-hang.md b/.changeset/strong-colts-hang.md new file mode 100644 index 000000000000..90b822b41d42 --- /dev/null +++ b/.changeset/strong-colts-hang.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fix "Cannot read properties of null" error in CLI code diff --git a/packages/astro/src/cli/telemetry/index.ts b/packages/astro/src/cli/telemetry/index.ts index dffb18bd90d0..fd664fcc9441 100644 --- a/packages/astro/src/cli/telemetry/index.ts +++ b/packages/astro/src/cli/telemetry/index.ts @@ -9,7 +9,7 @@ interface TelemetryOptions { } export async function notify() { - const packageManager = (await whichPm(process.cwd())).name ?? 'npm'; + const packageManager = (await whichPm(process.cwd()))?.name ?? 'npm'; await telemetry.notify(() => { console.log(msg.telemetryNotice(packageManager) + '\n'); return true;