What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Getting error when creating first Shopify theme. shopify theme dev

Getting error when creating first Shopify theme. shopify theme dev

ronakgiriraj
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 2.44.0.windows.1

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
Raj/AppData/Local/shopify-gems-nodejs/Cache/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c
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
/usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xc
ode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi...
no
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
Raj/AppData/Local/shopify-gems-nodejs/Cache/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c
make DESTDIR\= sitearchdir\=./.gem.20240601-7156-enga6p
sitelibdir\=./.gem.20240601-7156-enga6p clean

current directory: C:/Users/Ronak Giri
Raj/AppData/Local/shopify-gems-nodejs/Cache/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c
make DESTDIR\= sitearchdir\=./.gem.20240601-7156-enga6p
sitelibdir\=./.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
Raj/AppData/Local/shopify-gems-nodejs/Cache/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi-x64-mingw-ucrt"
""/c/Users/Ronak(D)"'
make: *** [libffi.mk:6: "/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
inspection.
Results logged to C:/Users/Ronak Giri
Raj/AppData/Local/shopify-gems-nodejs/Cache/ruby/3.3.0/extensions/x64-mingw-ucrt/3.3.0/ffi-1.16.3/gem_make.out

  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
build_extensions'
  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'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/rubygems_gem_installer.rb:76:in
`build_extensions'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/source/rubygems.rb:206:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/installer/gem_installer.rb:54:in
`install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/worker.rb:62:in
`apply_func'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/worker.rb:57:in
`block in process_queue'
  <internal:kernel>:187:in `loop'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/worker.rb:54:in
`process_queue'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/bundler-2.5.11/lib/bundler/worker.rb:90:in
`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
      ffi
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Installing ffi 1.16.3 with native extensions
Ronak Giri Raj
Replies 2 (2)

SomeUsernameHe
Shopify Partner
517 57 110

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

firemio
Visitor
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)

@Shopify/cli@3.60.0