Shopify / shopify-cli

Shopify CLI helps you build against the Shopify platform faster.
https://shopify.dev/tools/cli
Other
1.01k stars 201 forks source link

Shopify app serve cannot find the correct gem path #2027

Closed irenenam closed 2 years ago

irenenam commented 2 years ago

Issue summary

The issue only happens when I install shopify through homebrew.

Install shopify-cli with brew install.

Run brew tap shopify/shopify
Run brew install shopify-cli

And checked the shopify version and got the latest version 2.11.0.

When I run the shopify app serve in the terminal, I was getting the error like below.

┏━━ Running server… ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

┃   /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/spec_set.rb:95:in `block in materialize': Could not find rake-13.0.6 in any of the sources (Bundler::GemNotFound)
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/spec_set.rb:90:in `map!'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/spec_set.rb:90:in `materialize'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:189:in `specs'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:258:in `specs_for'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/definition.rb:240:in `requested_specs'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:91:in `block in definition_method'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/runtime.rb:20:in `setup'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler.rb:149:in `setup'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
┃   from /opt/rubies/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
┃   from /Users/irenenam/src/github.com/Shopify/os2-sample-app/config/boot.rb:6:in `<top (required)>'
┃   from bin/rails:3:in `require_relative'
┃   from bin/rails:3:in `<main>'
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (0.2s) ━━
┏━━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ ✗ System call failed: bin/rails server

Put the log to see the GEM_PATH and the GEM_PATH sets as "/opt/homebrew/Cellar/shopify-cli/2.11.0" not as /opt/rubies/2.7.2/lib/.

This is my shopify system all info.

Environment
  TERM              = xterm-256color
  SHELL             = /bin/zsh
  PATH              = /opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/irenenam/.gem/ruby/2.7.2/bin:/opt/rubies/2.7.2/lib/ruby/gems/2.7.0/bin:/opt/rubies/2.7.2/bin:/Users/irenenam/.dev/yarn/1.21.1/bin:/Users/irenenam/.nvm/versions/node/v16.13.2/bin:/opt/homebrew/opt/mysql-client@5.7/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/homebrew/bin:/opt/dev/bin/user:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  LANG              = en_CA.UTF-8

Shopify CLI
               ROOT = /opt/homebrew/Cellar/shopify-cli/2.11.0/gems/shopify-cli-2.11.0
  PROJECT_TYPES_DIR = /opt/homebrew/Cellar/shopify-cli/2.11.0/gems/shopify-cli-2.11.0/lib/project_types
           TEMP_DIR = /opt/homebrew/Cellar/shopify-cli/2.11.0/gems/shopify-cli-2.11.0/.tmp
          CACHE_DIR = /Users/irenenam/.cache/shopify
   TOOL_CONFIG_PATH = /Users/irenenam/.config/shopify
           LOG_FILE = /Users/irenenam/.config/shopify/logs/log.log
     DEBUG_LOG_FILE = /Users/irenenam/.config/shopify/logs/debug.log

Current Shop
  No store found. Please run shopify login --store=STORE to login to a specific store

Ruby (via RbConfig)
  /opt/homebrew/Cellar/ruby/3.1.0/bin/ruby
  arm64-apple-darwin21      - RbConfig["host"]
  ruby-3.1.0                - RbConfig["RUBY_VERSION_NAME"]

Commands
  ✓ git, /opt/homebrew/bin/git
  ✓ curl, /usr/bin/curl
  ✓ tar, /usr/bin/tar

In a Rails project directory
  ✓ gem, /opt/rubies/2.7.2/bin/gem, version 3.2.20
  ✓ rails, /Users/irenenam/.gem/ruby/2.7.2/bin/rails, version 2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:281:in
  ✓ rake, /Users/irenenam/.gem/ruby/2.7.2/bin/rake, version 2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:281:in
  ✓ ruby, /opt/rubies/2.7.2/bin/ruby, version 2.7.2p137
  ✓ ngrok, /Users/irenenam/.cache/shopify/ngrok

This does not happen with the installation through RubyGems. After I uninstall the brew and reinstall via the gem. shopfiy app serve works as expected.

irenenam commented 2 years ago

@amcaplan I reopened the issue, because it did not solve it yet. Also, I did tophat with the new version and getting this error when I do shopify version

irenenam@Irenes-MacBook-Pro  ~/src/github.com/Shopify/shopify-cli   main  brew install shopify-cli
==> Fetching shopify-cli from gem source
Downloaded shopify-cli-2.11.1
==> Installing shopify-cli from shopify/shopify
==> /opt/homebrew/opt/ruby/bin/gem install /Users/irenenam/Library/Caches/Homebrew/shopify-cli-2.11.1.gem --no-document --no-wrapper --no-user-install --install-dir /opt/homebrew/Cellar/shopify-cli/2.11.1 --bindir /opt/homebr
🍺  /opt/homebrew/Cellar/shopify-cli/2.11.1: 2,111 files, 40.9MB, built in 8 seconds
==> Running `brew cleanup shopify-cli`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
 irenenam@Irenes-MacBook-Pro  ~/src/github.com/Shopify/shopify-cli   main  shopify version
Traceback (most recent call last):
    2: from /Users/irenenam/.gem/ruby/2.7.5/bin/shopify:23:in `<main>'
    1: from /opt/rubies/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems.rb:300:in `activate_bin_path'
/opt/rubies/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems.rb:281:in `find_spec_for_exe': can't find gem shopify-cli (>= 0.a) with executable shopify (Gem::GemNotFoundException)
gonzaloriestra commented 2 years ago

The issue should be fixed in version 2.11.2. Please let me know if it doesn't.

irenenam commented 2 years ago

@gonzaloriestra 👋 I 🎩 ed. It works as expected. Thank you!

sshaw commented 1 year ago

Seeing this issue with @shopify/cli/3.30.2 darwin-x64 node-v14.18.2 (that's the output of npx shopify --version):

~/code/js/XXX/src/client >ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-darwin17]
~/code/js/XXX/src/client >npx shopify theme push XXXXX
npm WARN config init.author.name Use `--init-author-name` instead.
npm WARN config init.author.email Use `--init-author-email` instead.

── external error ────────────────────────────────────────────────────────────────────────────

Error coming from `bundle config set --local path /Users/sshaw/Library/Caches/shopify-cli-nodejs/vendor/ruby-cli/2.33.0`

Command failed with exit code 126: bundle config set --local path /Users/sshaw/Library/Caches/shopify-cli-nodejs/vendor/ruby-cli/2.33.0
No version set for command bundle
Consider adding one of the following versions in your config file at
ruby 2.6.6
ruby 2.7.2
ruby 3.1.3

──────────────────────────────────────────────────────────────────────────────────────────────

Node.js executable that depends on Ruby that depends on configuring bundler‽ 🤯

sshaw commented 1 year ago

Node.js executable that depends on Ruby that depends on configuring bundler‽ 🤯

Oh wait. This is the Shopify/shopify-cli repo. Not to be confused with the Shopfiy/cli repo which is where the Node.js code lives. Going to move this commentary there 🤯🤯

gonzaloriestra commented 1 year ago

@sshaw Yes, I was going to suggest that. Would you mind creating an issue there? We know it's a bit cumbersome right now, sorry.