Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ERROR on theme dev command when package.json in folder #4400

Closed
2 tasks done
nilshendriks opened this issue Aug 30, 2024 · 2 comments
Closed
2 tasks done

[Bug]: ERROR on theme dev command when package.json in folder #4400

nilshendriks opened this issue Aug 30, 2024 · 2 comments
Labels
Area: @shopify/theme @shopify/theme package issues moderate lowest severity for theme related bug Type: Bug Something isn't working

Comments

@nilshendriks
Copy link

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

when running:

shopify theme dev --environment=my-env-here

I expect the theme to be served locally and the terminal not to return an error.

Actual behavior

after running the command it starts as expected: it serves the theme locally but then it also throws an error but doesnt stop the process. So it is still possible to preview the theme.

but the error is:

Syncing theme #136509423777 on surf-turf-2-0.myshopify.com 100% • 10:29:29 ERROR » update package.json: The asset #<struct ShopifyCLI::Theme::File path=#<Pathname:/Users/studiohenk-nh/Sites/shopify-henk/package.json>> could not be synced (cause: undefined method dig' for nil) /usr/local/Cellar/shopify-cli/3.66.1/libexec/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:241:in parse_api_errors' /usr/local/Cellar/shopify-cli/3.66.1/libexec/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:203:in handle_operation_error'
/usr/local/Cellar/shopify-cli/3.66.1/libexec/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:301:in rescue in perform' /usr/local/Cellar/shopify-cli/3.66.1/libexec/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:300:in perform'
/usr/local/Cellar/shopify-cli/3.66.1/libexec/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:159:in block (3 levels) in start_threads' <internal:kernel>:187:in loop'
/usr/local/Cellar/shopify-cli/3.66.1/libexec/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:155:in block (2 levels) in start_threads'

Verbose output

/Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15: warning: observer was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add observer to your Gemfile or gemspec.
/Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec.
DEBUG GET https://theme-kit-access.shopifyapps.com/cli/admin/api/unstable/themes.json with request_id: 412791bd-bc62-4724-a1b1-b7fb0143580b-1725007037

  • Syncing theme #136509423777 on surf-turf-2-0.myshopify.com
    DEBUG GET https://theme-kit-access.shopifyapps.com/cli/admin/api/unstable/themes/136509423777/assets.json with request_id: 7d4373e8-5377-4cc9-85c6-d8fcceb25938-1725007037
    DEBUG ignore node_modules/@shopify/liquid-html-parser/package.json
    DEBUG ignore node_modules/@shopify/prettier-plugin-liquid/package.json
    DEBUG ignore node_modules/html-styles/index.json
    DEBUG ignore node_modules/html-styles/package.json
    DEBUG ignore node_modules/isarray/component.json
    DEBUG ignore node_modules/isarray/package.json
    DEBUG ignore node_modules/isobject/package.json
    DEBUG ignore node_modules/line-column/package.json
    DEBUG ignore node_modules/ohm-js/package.json
    DEBUG ignore node_modules/prettier/package.json
    DEBUG update package.json
    DEBUG PUT https://theme-kit-access.shopifyapps.com/cli/admin/api/unstable/themes/136509423777/assets.json with request_id: dd203e1f-b7ef-4078-9c6f-032172ab1f26-1725007038
    100%
    • 10:37:19 ERROR » update package.json:
    The asset #<struct ShopifyCLI::Theme::File path=#Pathname:/Users/studiohenk-nh/Sites/shopify-henk/package.json> could not be synced (cause: undefined method dig' for nil) /Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:241:in parse_api_errors'
    /Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:203:in handle_operation_error' /Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:301:in rescue in perform'
    /Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:300:in perform' /Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:159:in block (3 levels) in start_threads'
    internal:kernel:187:in loop' /Users/studiohenk-nh/.nvm/versions/node/v20.16.0/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb:155:in block (2 levels) in start_threads'
    [2024-08-30 10:37:19] INFO WEBrick 1.7.0
    [2024-08-30 10:37:19] INFO ruby 3.3.4 (2024-07-09) [x86_64-darwin22]
    [2024-08-30 10:37:19] INFO WEBrick::HTTPServer#start: pid=28245 port=9292
    DEBUG Refreshing preview _shopify_essential cookie
    DEBUG Proxying HEAD https://theme-kit-access.shopifyapps.com/cli/sfr/?preview_theme_id=136509423777&_fd=0&pb=0
    DEBUG -> 302 request_id: 7de74eea-ea3c-4a3c-a7b0-e17614c44808-1725007045 DEBUG Proxying GET https://theme-kit-access.shopifyapps.com/cli/sfr/?_fd=0&pb=0&preview_theme_id=136509423777&_fd=0&pb=0 DEBUG -> 302 request_id: 141c0886-3f47-4423-96bd-e0775e3492a4-1725007046
    DEBUG Proxying GET https://theme-kit-access.shopifyapps.com/cli/sfr/?_fd=0&pb=0&_fd=0&pb=0
    DEBUG -> 200 request_id: 7d72d658-1545-4f4c-a8d5-fc3151696efa-1725007046 DEBUG Renew _shopify_essential cookie by the response DEBUG [HotReload] Connected to SSE stream DEBUG Proxying GET https://theme-kit-access.shopifyapps.com/cli/sfr/checkouts/internal/preloads.js?locale=en-NL&_fd=0&pb=0 DEBUG -> 404 request_id: 009cafe7-7f90-4b59-a8f2-d98f0834d1cf-1725007048

Reproduction steps

  1. in shopify project / theme folder run: shopify theme dev --environment=my-env-here when there is a package.json file
  2. see error

Operating System

MacOS 13.4 Ventura

Shopify CLI version (check your project's package.json if you're not sure)

3.66.1

Shell

zsh

Node version (run node -v if you're not sure)

v20.16.0

What language and version are you using in your application?

No response

@nilshendriks nilshendriks added the Type: Bug Something isn't working label Aug 30, 2024
@nilshendriks nilshendriks changed the title [Bug]: <YOUR ISSUE TITLE> [Bug]: ERROR on theme dev command when package.json in folder Aug 30, 2024
@lucyxiang lucyxiang added Area: @shopify/theme @shopify/theme package issues moderate lowest severity for theme related bug labels Sep 3, 2024
@SimonShirley
Copy link

I found this issue because I was getting the same error message.

In my case it turned out that I had a dist/ folder that I hadn't spotted in the same directory that I was trying to run shopify theme dev in. The dist/ folder isn't part of the Shopify folder structure, so when it synchronises the theme, Shopify doesn't know what to do with it.

How I solved it was to remove that folder (as it shouldn't have been there - it was left over from a previous refactor) but the real solution is to update your .shopifyignore file, such that all files and folders that are not part of the Shopify theme template get excluded.

Any files or folders that are not part of the Shopify folder structure should be listed in your .shopifyignore file.

@nilshendriks
Copy link
Author

Thanks for responding! It made me have another look and guess what?

My .shopifyignore file had a space between the dot and the rest. Insert shame emoji.

I'll see if I can close this issue as solved. Again, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/theme @shopify/theme package issues moderate lowest severity for theme related bug Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants