无法在 Window 11 上安装 Shopify-CLI:无法从平台 x64-mingw-ucrt 确定 OS

Can't install Shopify-CLI on Window 11: Could not determine OS from platform x64-mingw-ucrt

我按照 shopify 网站上的说明进行操作,一切似乎都安装正确...直到我尝试使用 shopify version

进行确认

这是命令输出:

C:\WINDOWS\system32>gem install shopify-cli
Fetching shopify-cli-2.7.4.gem
Successfully installed shopify-cli-2.7.4
Parsing documentation for shopify-cli-2.7.4
Installing ri documentation for shopify-cli-2.7.4
Done installing documentation for shopify-cli after 3 seconds
1 gem installed

C:\WINDOWS\system32>shopify version
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui/os.rb:15:in `current': Could not determine OS from platform x64-mingw-ucrt (RuntimeError)
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui/spinner.rb:13:in `<module:Spinner>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui/spinner.rb:6:in `<module:UI>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui/spinner.rb:5:in `<module:CLI>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui/spinner.rb:4:in `<top (required)>'
        from <internal:C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/bin/shopify:9:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui.rb:19:in `<module:UI>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui.rb:2:in `<module:CLI>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui.rb:1:in `<top (required)>'
        from <internal:C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/bin/shopify:9:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/lib/shopify_cli.rb:24:in `<top (required)>'
        from <internal:C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:C:/Ruby31-x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/bin/shopify:9:in `require'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/bin/load_shopify.rb:18:in `<top (required)>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/bin/shopify:32:in `require_relative'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/bin/shopify:32:in `<top (required)>'
        from C:/Ruby31-x64/bin/shopify:25:in `load'
        from C:/Ruby31-x64/bin/shopify:25:in `<main>'

非常感谢任何帮助

似乎是一个错误。你应该报告它 on their Github page,但同时你可以自己修复它:

在您的编辑器中打开文件:

C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.7.4/vendor/deps/cli-ui/lib/cli/ui/os.rb

找到写着:

的行(第 12 行附近)
    when /mingw32/
      Windows

改为:

    when /mingw/
      Windows

现在再试一次。

此问题已在 version 2.10.2 中修复。