summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mohammed Elhaouari <m@codiume.com> 2023-09-07 09:39:42 +0100
committerGravatar GitHub <noreply@github.com> 2023-09-07 10:39:42 +0200
commit0fa483283e54c94f173838cd558dc0dbdd11e699 (patch)
treebfa1bf964b328ee6c2a3c01d1b4f326e4d144eab
parent8a08cb8d2a5ba3fb70608207558e58fdcc5f5193 (diff)
downloadastro-0fa483283e54c94f173838cd558dc0dbdd11e699.tar.gz
astro-0fa483283e54c94f173838cd558dc0dbdd11e699.tar.zst
astro-0fa483283e54c94f173838cd558dc0dbdd11e699.zip
Fix "Cannot read properties of null" in cli/telemetry (#8443)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
-rw-r--r--.changeset/strong-colts-hang.md5
-rw-r--r--packages/astro/src/cli/telemetry/index.ts2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/strong-colts-hang.md b/.changeset/strong-colts-hang.md
new file mode 100644
index 000000000..90b822b41
--- /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 dffb18bd9..fd664fcc9 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;