cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open patmead opened this issue 1 year ago • 17 comments

Please confirm that you have:

  • [X] 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.)
  • [X] Reproduced the issue in the latest CLI version.

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

patmead avatar Feb 01 '24 07:02 patmead

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

MalcolmFellowes avatar Feb 04 '24 18:02 MalcolmFellowes

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.

github-actions[bot] avatar Mar 18 '24 03:03 github-actions[bot]

This issue is still relevant

patmead avatar Mar 18 '24 03:03 patmead

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.

github-actions[bot] avatar May 01 '24 03:05 github-actions[bot]

Still relevant.

flortsch avatar May 03 '24 07:05 flortsch

stilll relevent

nihanmubashshir avatar May 23 '24 19:05 nihanmubashshir

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>'

gil-roboute avatar May 29 '24 03:05 gil-roboute

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!

karreiro avatar Jun 03 '24 13:06 karreiro

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,

gil-roboute avatar Jun 04 '24 12:06 gil-roboute

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.

lucyxiang avatar Jun 04 '24 17:06 lucyxiang

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.

gil-roboute avatar Jun 05 '24 01:06 gil-roboute

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.

flortsch avatar Jun 05 '24 10:06 flortsch

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

lucyxiang avatar Jun 05 '24 18:06 lucyxiang

Still relevant. on Arch WSL

fgbyte avatar Jul 15 '24 21:07 fgbyte

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?

flortsch avatar Aug 13 '24 12:08 flortsch

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 <top (required)>' /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 module:ShopifyCLI' /usr/lib/node_modules/@shopify/cli/dist/assets/cli-ruby/lib/shopify_cli.rb:42:in <top (required)>' /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 <top (required)>' /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

'

gil-roboute avatar Aug 14 '24 10:08 gil-roboute

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

emp3ror avatar Aug 16 '24 04:08 emp3ror

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

Still same issue

ultraammar avatar Sep 07 '24 06:09 ultraammar

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

Akayashuu avatar Sep 09 '24 20:09 Akayashuu

👋 Thank you, everyone, for reporting! I'm closing the issue as Ruby is no longer required to run the latest version of Shopify CLI.

karreiro avatar Sep 20 '24 06:09 karreiro