From a03d9efd071a54b0a418d6da7e6817c3a64cfe51 Mon Sep 17 00:00:00 2001 From: Charley Wu Date: Fri, 10 Jun 2022 21:21:25 +0800 Subject: [PATCH] Improve the `yarn` command detection --- .../Volo/Abp/Cli/LIbs/InstallLibsService.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs index 71cf789c9c..08b89d9547 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/LIbs/InstallLibsService.cs @@ -253,17 +253,10 @@ public class InstallLibsService : IInstallLibsService, ITransientDependency private bool IsYarnAvailable() { - var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g --depth 0").Trim(); - if (output.Contains("empty")) - { - return false; - } - - if (!SemanticVersion.TryParse(output.Substring(output.IndexOf('@') + 1), out var version)) - { + var output = CmdHelper.RunCmdAndGetOutput("yarn -v").Trim(); + if (!SemanticVersion.TryParse(output, out var version)){ return false; } - return version > SemanticVersion.Parse("1.20.0"); } }