Shopify / cli

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

[Bug]: shopify theme dev gets stuck on Windows #3696

Open lastant opened 5 months ago

lastant commented 5 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

shopify theme dev should start a local server

Actual behavior

The command doesn't have any output at all

Verbose output

Authentication is OK, the last relevant lines are:

2024-04-11T14:44:59.615Z: The identity token is valid: true
2024-04-11T14:44:59.615Z:
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false

2024-04-11T14:44:59.634Z:
Running system process:
  · Command: ruby -v
  · Working directory: c:/Work/[theme directory]

2024-04-11T14:44:59.720Z:
Running system process:
  · Command: bundle -v
  · Working directory: c:/Work/[theme directory]

2024-04-11T14:45:00.518Z: Reading the content of file at C:/Programs/nvm/v20.10.0/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile...
2024-04-11T14:45:00.520Z: Appending the following content to C:/Programs/nvm/v20.10.0/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/Gemfile:
      gem 'wdm', '>= 0.1.0'

2024-04-11T14:45:00.527Z:
Running system process:
  · Command: bundle install
  · Working directory: C:/Programs/nvm/v20.10.0/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby

2024-04-11T14:45:23.766Z:
Running system process:
  · Command: bundle exec ruby C:/Programs/nvm/v20.10.0/node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify theme token --admin atkn_Cp8DCOzu37AGEIyn4LAGYpADCAESEMpGh03MuUSOo0PMeFVmRFAaqAFodHRwczovL2FwaS5zaG9waWZ5LmNvbS9hdXRoL3BhcnRuZXJzLmNvbGxhYm9yYXRvci1yZWxhdGlvbnNoaXBzLnJlYWRvbmx5IGh0dHBzOi8v1234LnNob3BpZnkuY29tL2F1dGgvc2hvcC5hZG1pbi5ncmFwaHFsIGh0dHBzOi8vYXBpLnNob3BpZnkuY29tL2F1dGgvc2hvcC5hZG1pbi50aGVtZXMgDSinUzIQCN3zBAajTJa6QoE0BZRCoTokMzMzNWY2MDktZTMzYi00NTE4LTg0ODItMzBhMTkxZDI2MjYxQgdBY2NvdW50ShAkZyISZxBDcq1HKVHbfac6UlN7InN1YiI6ImZiZGIyNjQ5LWUzMjctNDkwNy04ZjY3LTkwOGQyNGNmZDdlMyIsImlzcyI6Imh0dHBzOi8vYWNjb3VudHMuc2hvcGlmeS5jb20ifWIQYbb548mjR4Guabn473jggWoQZ29uYrTDTIqu7KY3Au8-8xJAbhbR6M3Ohc3bVar4zb4vZ5k7-NC2beWAl8PCtv8CLiD-tIWyrkpIWjSj5D34-KQLeF90q6nIMeczHpXl21w2Dg --sfr atkn_CqMCCOzu37AGEIyn4LAGYpQCCA1234LP5TQetkBujB1D9EyVeYoaPmh0dHBzOi8vYXBpLnNob3BpZnkuY29tL2F1dGgvc2hvcC5zdG9yZWZyb250LXJlbmRlcmVyLmRldnRvb2xzINhSKKdTOiQzMzM1ZjYwOS1lMzNiLTQ1MTgtODQ4Mi0zMGExOTFkMjYyNjFCB0FjY291bnRKECRnIhJnEENyrUcpUdt9pzpSU3sic3ViIjoiZmJkYjI2NDktZTMyNy00OTA3LThmNjctOTA4ZDI0Y2ZkN2UzIiwiaXNzIjoiaHR0cHM6Ly9hY2NvdW50cy5zaG9waWZ5LmNvbSJ9YhBhtvnjyaNHga5pufjveOCBahBnb25itMNMiq7spjcC7z7zEkCkAM_8AesqIPJdm7Z0cWXNBI5zPyCkKWQwYHGpu2Z_490JXKrYws-x27SSDfKuVJ0qAArwMhLp0x6NcUs8GjAM
  · Working directory: c:/Work/[theme directory]


### Reproduction steps

1. run `shopify theme dev` from the theme directory

### Operating System

Windows 11

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

@shopify/cli/3.58.2 win32-x64 node-v20.10.0

### Shell

cmd

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

v20.10.0

### What language and version are you using in your application?

ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x64-mingw-ucrt]
karreiro commented 4 months ago

Thank you for reporting this issue, @lastant!

Currently, the Shopify CLI requires exactly Ruby 3.0 to work on Windows due to some incompatibility issues. The CLI contributors/maintainers are already working on improving this aspect, and soon it will no longer require Ruby on your machine.

Thanks again for reporting this!

lastant commented 4 months ago

@karreiro Thank you for point it out, but even with Ruby 3.0 the result is the same...

>shopify theme info
THEME CONFIGURATION
Store                  [store].myshopify.com
Development Theme ID   Not set

TOOLING AND SYSTEM
Shopify CLI    3.59.1
OS             windows-amd64
Shell          unknown
Node version   v20.12.2
Ruby version   3.0.6
karreiro commented 4 months ago

Thank you for the extra details, @lastant!

Could you confirm if, during the installation, the MSYS2 component and the MSYS2 base installation option were selected? That's important because the Ruby CLI depends on wdm, which may require a native compilation process (and those options help with that). Since the CLI is really using Ruby 3.0, that's likely the problem.

Please let me know how it goes!

StewPoll commented 4 months ago

@karreiro The article you linked lists the requirement for ruby as "2.7.0 or greater" not as "Exactly 3.0" image

If it requires 3.0, the docs should be updated as such.

I will say I've seen similar happen before when it's the first time running the CLI after installing it, it's often very slow, but subsequent runs are a lot faster. Unsure what happens behind the scenes.

karreiro commented 4 months ago

Thank you for the feedback, @StewPoll! There's an issue in the user experience; we need to select Windows as the platform to check the Ruby 3.0 requirement and the MSYS2 details:

image

I hope this helps!

lastant commented 4 months ago

@karreiro Yes I did '1 - MSYS2 base installation' and '2 - MSYS2 system update (optional)', even tried '3 - MSYS2 and MINGW development toolchain', still the same. Maybe you can tell me where to put some debug commands in the code to find the cause. I tried looking into the shopify/cli code, but I don't know ruby that well. Again, the most important parts I think are that it gets stuck on bundle exec ruby .......node_modules/@shopify/theme/node_modules/@shopify/cli-kit/assets/cli-ruby/bin/shopify theme token --admin atkn_Cp8... and that Development Theme ID appears to be Not set.

github-actions[bot] commented 1 month 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.

lastant commented 1 month ago

Tried again with the newest version (@shopify/cli/3.64.1 win32-x64 node-v20.10.0), still the same...

github-actions[bot] commented 1 week 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.

lastant commented 1 week ago

It's still relevant...