Shopify CLI on Windows 10 fails to log in with “An unexpected error occurred,” rooted in an OS detection error: Ruby reports platform x64-mingw-ucrt, which the CLI doesn’t recognize as Windows.
The error surfaces in vendor libraries cli-kit and cli-ui, throwing “Could not determine OS from platform x64-mingw-ucrt.” This affects CLI 2.9.0 and persists (in another module) after upgrading to 2.10.0.
Workaround (manual edits in installed gem files):
In cli-kit system.rb, add: return :windows if /mingw/.match(RUBY_PLATFORM) alongside existing darwin/linux/mingw32 checks.
In cli-ui os.rb, add a case branch mapping /mingw/ to Windows, in addition to /mingw32/.
Outcome: Applying both changes in 2.10.0 allowed reading the CLI version and logging in successfully. One participant initially edited only system.rb; the error then moved to cli-ui until both files were patched.
A participant who couldn’t replicate the fix asked for exact lines; detailed guidance was provided. This is described as a temporary kludge covering a Windows 10 (64-bit) detection bug. No official upstream fix or resolution is noted; the thread remains open pending a Shopify patch.
New app developer here. On win-10 I have installed shopify cli, version is reported as 2.9.0. Logged into partner account, with development store open in another window. I am owner of both. Using shopify login --store=[store name] (without the 's)
I am unable to login, get error “An unexpected error occurred.” Same regardless of whether using administrative access to cmd window.
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/system.rb:181:in os': Could not determine OS from platform x64-mingw-ucrt (RuntimeError) from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/system.rb:211:in resolve_path’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/system.rb:126:in system' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/context.rb:492:in system’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/context.rb:386:in open_browser_url!' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/identity_auth.rb:136:in open_browser_authentication’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/identity_auth.rb:132:in initiate_authentication' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/identity_auth.rb:61:in authenticate’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/commands/login.rb:31:in call' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/command.rb:30:in call’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/core/executor.rb:17:in block (2 levels) in call' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:37:in block (2 levels) in with_logging’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb:169:in with_id' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:36:in block in with_logging’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-ui/lib/cli/ui.rb:176:in log_output_to' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:35:in with_logging’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/core/executor.rb:16:in block in call' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:45:in block (2 levels) in with_traps’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:51:in twrap' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:44:in block in with_traps’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:51:in twrap' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/executor.rb:43:in with_traps’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/core/executor.rb:15:in call' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/core/entry_point.rb:24:in block in call’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/core/monorail.rb:30:in log' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/lib/shopify_cli/core/entry_point.rb:23:in call’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/bin/shopify:37:in block (2 levels) in <top (required)>' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:75:in handle_abort’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb:21:in call' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/bin/shopify:36:in block in <top (required)>’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/bin/shopify:47:in <top (required)>' from C:/Ruby31-x64/bin/shopify:25:in load’
from C:/Ruby31-x64/bin/shopify:25:in `’
You are brilliant, @sanjos ! I did as you said and the error message disappeared.
Then I did something I think very stoooopid. The shopify cli code told me there was a new version, 2.10.0 and would I like to install it? Sure, I said, but WRONG ANSWER!
It installed, I made the same correction you recommended, this time in C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/vendor/deps/cli-kit/lib/cli/kit/system.rb
But … sigh … the error returned. I …
uninstalled both versions of shopify-cli (including .exe) using “gem uninstall shopify-cli” (which reported success)
re-made the correction in the new C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/vendor/deps/cli-kit/lib/cli/kit/system.rb
… but to no avail. The error trace (when I just ask for “shopify version”) now looks like:
C:\Users\jb>shopify version
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/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.10.0/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.10.0/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.10.0/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.10.0/vendor/deps/cli-ui/lib/cli/ui/spinner.rb:4:in <top (required)>' from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require’
from internal:C:/Ruby31-x64/lib/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.10.0/bin/shopify:9:in require’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/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.10.0/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.10.0/vendor/deps/cli-ui/lib/cli/ui.rb:1:in <top (required)>' from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require’
from internal:C:/Ruby31-x64/lib/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.10.0/bin/shopify:9:in require’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/lib/shopify_cli.rb:25:in <top (required)>' from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require’
from internal:C:/Ruby31-x64/lib/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.10.0/bin/shopify:9:in require’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/bin/load_shopify.rb:18:in <top (required)>' from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/bin/shopify:32:in require_relative’
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/bin/shopify:32:in <top (required)>' from C:/Ruby31-x64/bin/shopify:25:in load’
from C:/Ruby31-x64/bin/shopify:25:in `’
C:\Users\jb>
… What on earth is happening here? I thought that doing the version upgrade would be innocuous, but did I do something bad? What do you suggest here?
I get it. @sanjos had it right as far as was known, but it seems there are (at least) TWO places the change is needed, as the shopify code duplicates this set of errant statements.