From 65d5a6f9ad02912d44be35651add1c1f69944d72 Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:39:20 +0900 Subject: [PATCH] fix: old deno gives an error when using `deno -v` --- src/hooks/dependencies.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hooks/dependencies.ts b/src/hooks/dependencies.ts index 3f9aab1..572c808 100644 --- a/src/hooks/dependencies.ts +++ b/src/hooks/dependencies.ts @@ -47,8 +47,14 @@ const registerInstallationHook = ( if (!installedPackageManagerNames.length) return // If version 1 of Deno is installed, it will not be suggested because it doesn't have "deno install". if (installedPackageManagerNames.includes('deno')) { - const { stdout } = await execa('deno', ['-v']) - if (stdout.split(' ')[1].split('.')[0] == '1') { + let isVersion1 = false + try { + const { stdout } = await execa('deno', ['-V']) + isVersion1 = stdout.split(' ')[1].split('.')[0] == '1' + } catch { + isVersion1 = true + } + if (isVersion1) { installedPackageManagerNames.splice( installedPackageManagerNames.indexOf('deno'), 1,