build command failing due to conflicting requirements for the Ruby version by theme check

Solved

build command failing due to conflicting requirements for the Ruby version by theme check

ayush-rzp
Shopify Partner
2 0 0

Hi,
I've been getting the following build error on my system; it's working fine on my peers systems. It's been a few days, and I have read so many discussions & answers but am still unable to resolve them. Any help would be deeply appreciated 🙏

 

Error

`dev` command runs fine, but `build` is always failing with the following error. Our app is on top of shopify's qrcode template.

 

 

npm run build

> ***@0.1.0 build
> shopify app build


customer-wallet │ Running theme check on your Theme app extension...
web-frontend    │
web-frontend    │ > build
web-frontend    │ > vite build
web-frontend    │
web-frontend    │ vite v2.9.17 building for production...
web-frontend    │ transforming...

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

Error coming from `bundle install`

Command failed with exit code 6: bundle install
Bundler found conflicting requirements for the Ruby version:
  In Gemfile:
    Ruby

    theme-check (= 1.15.0) was resolved to 1.15.0, which depends on
      Ruby (>= 2.7)
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...

 

 

Environment

I've tried running the build command on various ruby versions using rbenv namely - system, 2.7.8, 3.1.0, 3.1.3 ; but same error everywhere.

  1. ruby -v
    ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin22]
  2. rbenv local
    3.1.0
  3. gem list | grep bundler
    bundler (2.5.6, default: 2.3.3)
  4. openssl version
    OpenSSL 3.2.1 30 Jan 2024 (Library: OpenSSL 3.2.1 30 Jan 2024)
  5. Shopify CLI 3.48.0 💡 Version 3.56.2 available! Run yarn shopify upgrade
    Package manager yarn
    OS darwin-arm64
    Shell /bin/zsh
    Node version v18.16.0
    System:
    OS: macOS 13.6.1
    CPU: (8) arm64 Apple M1
    Memory: 61.30 MB / 16.00 GB
    Shell:
    version: "5.9"
    path: /bin/zsh
    Binaries:
    Node:
    version: 18.16.0
    path: ~/.n/bin/node
    Yarn:
    version: 1.22.21
    path: ~/Documents/rzp/shopify-wallet/node_modules/.bin/yarn
    npm:
    version: 9.5.1
    path: ~/.n/bin/npm
    Watchman:
    version: 2022.07.04.00
    path: /usr/local/bin/watchman
    Managers:
    CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
    Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
    Languages:
    Java:
    version: 11.0.22
    path: /usr/bin/javac
    Ruby:
    version: 3.1.0
    path: /Users/ayush.gupta/.rbenv/shims/ruby


Accepted Solution (1)

Liam
Community Manager
3108 341 879

This is an accepted solution.

Hi Ayush,

 

If you run `yarn shopify upgrade` does this fix anything?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 3 (3)

Liam
Community Manager
3108 341 879

This is an accepted solution.

Hi Ayush,

 

If you run `yarn shopify upgrade` does this fix anything?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ayush-rzp
Shopify Partner
2 0 0

Hi Liam, I upgraded Shopify CLI & it has fixed the build command. but when I ran `yarn dev`, it failed with the below warning - "Warning: Invalid hook call. Hooks can only be called inside of the body of a function component". According to the docs, I found out that there are two React versions in my app. The newer Shopify app & cli ships with React 18. Running `npm ls react` gave the following output:

image.png

I followed React 18 upgrade guide & it resolved all issues for me.

However, I'm still unsure what was causing issues in my system even though it was working on my colleagues' system with the same dependencies. Anyways, it's resolved for now.

 

Appreciate the quick response, I was blocked here for days. 🙌

 

Liam
Community Manager
3108 341 879

Very strange but I'm glad it's back working for you

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog