From cf9e3485446abeabddd742b2743941313a492a56 Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Thu, 10 Oct 2024 23:30:04 +0900 Subject: [PATCH] fix: old deno gives an error when using `deno -v` (#75) * fix: old deno gives an error when using `deno -v` * check version with -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..dc706b7 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,