Getting error when creating first Shopify theme. shopify theme dev

Shopify Partner
2 0 0

i installed 

  • nodeJs -v = v20.13.1
  • ruby -v = ruby 3.3.1 (2024-04-23 revision c56cd86388) [x64-mingw-ucrt]
  • bundler -v = Bundler version 2.5.11
  • git -v = git version

then i runed this commands 

  • npm install -g @Shopify/cli
    and got -v = @Shopify/cli/3.61.0 win32-x64 node-v20.13.1
  • shopify theme init rup-rang
    and got my rup-rang folder

But when i running shopify theme dev --store=my-store
i logged in thene getting error why 😞 
i am tried multiple times used chatGPT but error not fixed.

the error 

C:\WebDev\Shopify\Theme\rup-rang>shopify theme dev
── external error ──────────────────────────────────────────────────────────────

Error coming from `bundle install`

Command failed with exit code 5: bundle install
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: C:/Users/Ronak Giri
C:/Ruby33-x64/bin/ruby.exe extconf.rb
checking for pkg-config for libffi... not found
checking for ffi.h... no
checking for ffi.h in
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... yes
checking for rb_gc_mark_movable()... yes
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile

current directory: C:/Users/Ronak Giri
make DESTDIR\= sitearchdir\=./.gem.20240601-7156-enga6p
sitelibdir\=./.gem.20240601-7156-enga6p clean

current directory: C:/Users/Ronak Giri
make DESTDIR\= sitearchdir\=./.gem.20240601-7156-enga6p
generating ffi_c-x64-mingw-ucrt.def
/bin/sh: -c: line 1: syntax error near unexpected token `('
/bin/sh: -c: line 1: `mkdir -p "/c/Users/Ronak Giri
make: *** [ "/c/Users/Ronak] Error 2

make failed, exit code 2

Gem files will remain installed in C:/Users/Ronak Giri
Raj/AppData/Local/shopify-gems-nodejs/Cache/ruby/3.3.0/gems/ffi-1.16.3 for
Results logged to C:/Users/Ronak Giri

  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:125:in `run'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:51:in `block in make'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `each'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:43:in `make'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/ext_conf_builder.rb:42:in `build'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:193:in `build_extension'
C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:227:in `block in
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `each'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/ext/builder.rb:224:in `build_extensions'
  C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/installer.rb:852:in `build_extensions'
`block in worker_pool'
`block in process_queue'
  <internal:kernel>:187:in `loop'
`block (2 levels) in create_threads'

An error occurred while installing ffi (1.16.3), and Bundler cannot continue.

In Gemfile:
  listen was resolved to 3.7.1, which depends on
    rb-inotify was resolved to 0.11.1, which depends on
Fetching gem metadata from
Resolving dependencies...
Installing ffi 1.16.3 with native extensions
Ronak Giri Raj
Replies 2 (2)

Shopify Partner
475 53 95

It looks like the error you're encountering when trying to run shopify theme dev is due to a failure in installing the ffi gem, a common Ruby library used to write Ruby extensions in C and to load dynamic libraries. The log indicates that the error arises because the ffi gem cannot find the required libffi library or its headers during installation.

Here are some steps to potentially resolve this issue on a Windows environment:

  1. Install libffi: You need to ensure that libffi is installed and its headers are accessible. This might not be straightforward on Windows, as it often requires manually downloading or using a package manager like MSYS2 or Cygwin.

    • Using MSYS2 (recommended):
      1. Download and install MSYS2 from here.
      2. Open the MSYS2 terminal.
      3. Update the package database and base packages with: pacman -Syu
      4. Install libffi by running: pacman -S mingw-w64-x86_64-libffi
      5. Add the MSYS2 bin directory to your PATH (usually C:\msys64\mingw64\bin).
  2. Configure Environment Variables: Ensure that Ruby can find the libffi headers and libraries. You may need to set the PKG_CONFIG_PATH environment variable to point to the directory containing libffi.pc. This is typically within the lib\pkgconfig folder inside your MSYS2 installation.

  3. Install the ffi Gem Manually:

    • Open a command prompt or PowerShell as an administrator.
    • Ensure your gem environment is set up correctly by running gem env.
    • Try installing ffi manually with: gem install ffi -- --with-ffi-dir=/path/to/MSYS2/libffi
  4. Run Bundle Install:

    • Go back to your project directory.
    • Run bundle install to ensure all dependencies are met.
  5. Retry Running the Shopify Theme Command:

    • Try running shopify theme dev --store=my-store again.

If you continue to face issues, it may be useful to ensure that your development environment matches the expected setup for Shopify theme development, which often means aligning with the versions of Node.js, Ruby, and other dependencies that are known to be compatible. Additionally, checking for spaces or special characters in your directory paths might also help, as they can sometimes cause issues with Ruby gems and native extensions.


Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee

1 0 0

It works. not WSL2

- Windows11

- vscode(powershell)

- nodejs v20.14.0

- Ruby+Devkit 3.0.7-1 (x64)

|- MSYS2

|- base system(1,2,3)