Personalized checkout and custom promotions with Shopify Scripts
I need help with the shopify theme serve command. I'm getting this error message.
Any help would be greatly appreciated. Thanks.
If you read the error it advises you on what steps to take.
It's telling you to add the following environment variable then run the command again:
SHOPIFY_CLI_STACKTRACE=1
To do that, if you're on some kind of Linux setup is as simple as running:
export SHOPIFY_CLI_STACKTRACE=1
Or if you're in windows and using PowerShell, run this command:
$env:SHOPIFY_CLI_STACKTRACE=1
Or if you're on Windows running a normal command prompt:
set SHOPIFY_CLI_STACKTRACE=1
Now you've got that environment variable in your current shell session - you'll run the command again and you should see a more detailed error:
shopify theme serve
If you post the output of that we should be able to give you some more guidance on the root cause of the error.
Thank you for the quick response. However, im still getting these error messages.
PS C:\Users\l0wk3y\Documents\Shopify Themes> shopify theme serve
X An unexpected error occured.
To submit an issue include the stack trace.
? Send an anonymized error report to Shopify? (Navigate up with 'k' and down with 'j', press Ente? Send an anonymized error report to Shopify? (You chose: Yes, send)
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/dev_server.rb:95:in `rescue in start': undefined method `shop' for nil:NilClass (NoMethodError)
raise ShopifyCLI::Abort, @ctx.message("theme.serve.ensure_user", theme.shop)
^^^^^
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/dev_server.rb:30:in `start'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/project_types/theme/commands/serve.rb:26:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/command/sub_command.rb:16:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/command.rb:27:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/lib/shopify_cli/core/executor.rb:15:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/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.15.2/lib/shopify_cli/core/monorail.rb:26:in `log'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/core/entry_point.rb:23:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/bin/shopify:50:in `block (2 levels) in <top (required)>'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/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.15.2/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.15.2/bin/shopify:49:in `block in <top (required)>'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/bin/shopify:59:in `<top (required)>'
from C:/Ruby31-x64/bin/shopify:32:in `load'
from C:/Ruby31-x64/bin/shopify:32:in `<main>'
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/api.rb:74:in `block in
request': 403 (ShopifyCLI::API::APIRequestForbiddenError)
{"errors":"Unauthorized Access"}
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/vendor/deps/cli-kit/lib/cli/kit/util.rb:172:in `retry_after'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/api.rb:89:in `request'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/admin_api.rb:92:in `block in rest_request'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/vendor/deps/cli-kit/lib/cli/kit/util.rb:172:in `retry_after'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/admin_api.rb:95:in `rest_request'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/theme_admin_api.rb:36:in `rest_request'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/theme_admin_api.rb:22:in `post'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/theme.rb:108:in `create'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/development_theme.rb:37:in `ensure_exists!'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/development_theme.rb:71:in `find_or_create!'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/theme/dev_server.rb:32:in `start'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/project_types/theme/commands/serve.rb:26:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/command/sub_command.rb:16:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/lib/shopify_cli/command.rb:27:in `call'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/shopify-cli-2.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/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.15.2/vendor/deps/cli-kit/lib/cli/kit/executor.rb:45:in `block (2 levels) in with_traps'
Thank you for the response. I'm getting these error messages now.
Looks like something to do with there being no user?
Can you try logging out through the CLI and then back in again?
It's suggested in this GitHub issue where people were having similar issues:
What worked for me:
Command "shopify logout"
Command "shopify login --store=STORE"
Command "shopify theme serve"
Then see if you can successfully serve the theme?
still getting the same error message. 😞
Another user in that thread has suggested rolling back to an earlier version of the Shopify CLI.
Try running these commands, then logging in and running theme serve again:
gem uninstall shopify-cli
gem install shopify-cli -v 2.7.4
And see if that lets you run it?
The year-end shopping spree is around the corner! Is your online store ready for the ...
By JasonH Nov 10, 2024We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024