Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
409 stars 124 forks source link

[Bug]: Shopify CLI is broken by latest version of flori/json (v2.7.1) "[LoadError] cannot load such file -- json" #3346

Open patmead opened 7 months ago

patmead commented 7 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

After authenticating, the CLI should be able to retrieve theme files using shopify theme pull

Actual behavior

It fails with the error below, despite the CLI not having been modified locally in any way.

Verbose output

$ shopify theme pull

[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- json
       They are disabled.
       Please don't modify the CLI locally.
       If you would like to contribute to the CLI project, please refer to
       https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md

[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- json
       They are disabled.
       Please don't modify the CLI locally.
       If you would like to contribute to the CLI project, please refer to
       https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md

[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- json
       They are disabled.
       Please don't modify the CLI locally.
       If you would like to contribute to the CLI project, please refer to
       https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md

~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:9:in `require': cannot load such file -- json (LoadError)
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:9:in `require'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/lib/shopify_cli/context.rb:6:in `<top (required)>'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:9:in `require'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:9:in `require'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/lib/shopify_cli.rb:133:in `<module:ShopifyCLI>'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/lib/shopify_cli.rb:42:in `<top (required)>'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:9:in `require'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:9:in `require'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/load_shopify.rb:18:in `<top (required)>'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:45:in `require_relative'
    from ~/.local/lib/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify:45:in `<main>'

Reproduction steps

  1. Install all dependencies as per https://shopify.dev/docs/themes/tools/cli/install
  2. Install Shopify CLI using npm install -g @shopify/cli @shopify/theme
  3. Verfiy using shopify version
  4. Attempt to retrieve theme files with shopify theme pull (authenticate if required)

Operating System

Arch Linux

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

3.55.1

Shell

bash

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

v21.6.1

What language and version are you using in your application?

Liquid

MalcolmFellowes commented 7 months ago

I'm facing this exact issue on Arch Linux (same versions as above).

Downgrading flori/json from 2.7.1 to 2.6.3 fixes it.

That's this package on Arch (working version is 2.6.3-1).

The issue was raised here in Jan: https://github.com/Shopify/cli/issues/3221

github-actions[bot] commented 6 months ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

patmead commented 6 months ago

This issue is still relevant

github-actions[bot] commented 4 months ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

flortsch commented 4 months ago

Still relevant.

nihanmubashshir commented 3 months ago

stilll relevent

gil-roboute commented 3 months ago

Still relevant - executing 'shopify theme dev --store storename' presents the same issue of being unable to load JSON.


[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- json
       They are disabled.
       Please don't modify the CLI locally.
       If you would like to contribute to the CLI project, please refer to
       https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md

[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- json
       They are disabled.
       Please don't modify the CLI locally.
       If you would like to contribute to the CLI project, please refer to
       https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md

/home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require': cannot load such file -- json (LoadError)
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/context.rb:6:in `<top (required)>'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli.rb:133:in `<module:ShopifyCLI>'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli.rb:42:in `<top (required)>'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/load_shopify.rb:18:in `<top (required)>'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:52:in `require_relative'
    from /home/REDACTED/.npm-global/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:52:in `<main>'
karreiro commented 3 months ago

Hey @flortsch @nihanmubashshir @gil-roboute,

Could you please confirm if you're also facing this issue on Arch Linux? Also, could you please confirm the Ruby version you have?

Thanks a lot for reporting this!

gil-roboute commented 3 months ago

Hey @flortsch @nihanmubashshir @gil-roboute,

Could you please confirm if you're also facing this issue on Arch Linux? Also, could you please confirm the Ruby version you have?

Thanks a lot for reporting this!

I am using Manjaro Linux (Arch derivative) and current Ruby version is 3.0.6-1.

Thanks,

lucyxiang commented 3 months ago

Hello @gil-roboute, thank you for reporting this issue. The Shopify CLI doesn't officially support Arch Linux, we only support apt and yum for other linux distributions.

gil-roboute commented 3 months ago

Hi @lucyxiang be that as it may, I don't believe this to be an issue with my particular distro as I've had the same issue on my Windows 10 machine; I believe this is a Ruby versioning problem because I had to install a particular version of Ruby in order for the error to resolve on Windows.

Perhaps the next CLI update will bring everything into line and add support for Ruby 3.0.6-1; I do not like developing on a Windows based machine but I guess I will have to until this is resolved.

flortsch commented 3 months ago

Hey @flortsch @nihanmubashshir @gil-roboute,

Could you please confirm if you're also facing this issue on Arch Linux? Also, could you please confirm the Ruby version you have?

Thanks a lot for reporting this!

Can confirm the issue on Arch Linux. Ruby version is 3.0.6p216. It would be nice, if local / project-specific Ruby gems could be used with shopify-cli. Then, one could simply install an older version of ruby-json as a gem / project dependency instead of downgrading the system package.

lucyxiang commented 3 months ago

@gil-roboute we're working to remove Ruby as a dependency in the CLI, I appreciate the patience for now 🙏

fgbyte commented 2 months ago

Still relevant. on Arch WSL

flortsch commented 1 month ago

A few days ago, I got a ruby update on my Arch install. It seems that ruby and many sub-modules (such as the json module) where merged into the main ruby package. Also, ruby got updated to 3.2.4. I am now running shopify-cli 3.60.1 and I no longer have the json issue. Can someone confirm this as well?

gil-roboute commented 1 month ago

Full Manjaro release update - still receiving the below and the error messages contained in 'details' - half tempted to spin up a Debian VM and tolerate it so I don't have to use some Windows garbage to test themes.

They are disabled. Please don't modify the CLI locally. If you would like to contribute to the CLI project, please refer to https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md

Details

[Note] You cannot use gems with Shopify CLI. [LoadError] cannot load such file -- json /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli/context.rb:6:in `' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli.rb:133:in `' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli.rb:42:in `' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:15:in `require' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/load_shopify.rb:18:in `' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:52:in `require_relative' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/bin/shopify:52:in `

'

emp3ror commented 1 month ago

I have ruby 3.2.4 and shopify/cli 3.65.3 and there is same error (arch)

ultraammar commented 1 week ago

Shopify CLI 3.66.1 OS linux-amd64 Node version v22.8.0 Ruby version 3.2.5

Still same issue

Akayashuu commented 5 days ago

I had almost the same problems but with erb, it seems that the system functions were overwritten by ruby-json/ruby-erb, to fix this I had to downgrade it and find the right version. (in fact i used the last version)

I'm using Arch, ruby 3.2.5, node 18.20.4 and the last version of the Shopify CLI,

sudo downgrade ruby-json