Questions and discussions about using the Shopify CLI and Shopify-built libraries.
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.
As suggested by https://community.shopify.com/c/shopify-discussions/why-shopify-login-store-return-error-when-trying... I changed mingw32 to mingw, which had no effect.
Please advise! Thanks jb
Stack trace:
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 `<main>'
C:\WINDOWS\system32>
Solved! Go to the solution
This is an accepted solution.
For windows, go to this file C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/system.rb
and on line 181 add the below line of code:
return :windows if /mingw/.match(RUBY_PLATFORM)
This is an accepted solution.
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.
(1) C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/vendor/deps/cli-kit/lib/cli/kit/system.rb
(2) C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/vendor/deps/cli-ui/lib/cli/ui/os.rb
When I made the change in BOTH places, I got the current shopify version AND was able to login.
This is an accepted solution.
For windows, go to this file C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.9.0/vendor/deps/cli-kit/lib/cli/kit/system.rb
and on line 181 add the below line of code:
return :windows if /mingw/.match(RUBY_PLATFORM)
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 ...
1. uninstalled both versions of shopify-cli (including .exe) using "gem uninstall shopify-cli" (which reported success)
2. rebooted,
3. re-ran "gem install shopify-cli" (which reported success)
4. 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 `<main>'
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?
Thanks! jb
This is an accepted solution.
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.
(1) C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/vendor/deps/cli-kit/lib/cli/kit/system.rb
(2) C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.10.0/vendor/deps/cli-ui/lib/cli/ui/os.rb
When I made the change in BOTH places, I got the current shopify version AND was able to login.
This did not work.
When the solution says line 181, can someone be specific what line 181 at the time of solution means?
And what does the additional line do before we add it to the system file?