Shopify CLI - Error: cannot load such file --wdm - ruby

I am getting this error when running the command shopify theme dev with Shopify CLI:
[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- wdm
They are disabled.
Please don't modify the CLI locally.
If you would like to contribute to the CLI project, please refer to
https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Others who have had similar issues in the past suggested running gem install wdm, I have done this and had no success. Any help is appreciated!!
Operating System: Windows 11
Shopify-CLI: 3.23.0
Ruby: ruby 3.0.4p208(2022-04-12 revision 3fa771dded) [x64-mingw32]
Node.js: v18.12.1
Bundler version 2.3.25 (2022-11-02 commit 6b0b87b1ed)
git version 2.38.1.windows.1

I had the same problem. I upgraded to the latest version of Shopify CLI (3.32.1) and the problem got solved.
Use the Command Prompt and just enter the following command to upgrade Shopify CLI:
shopify upgrade

Related

Github pages installation: Jekyll -v output `require': cannot load such file -- google/protobuf_c (LoadError)

I'm trying to follow this guide on setting up a GitHub page website. I installed Homebrew, chruby, and Jekyll following this jekyllrb.com tutorial.
When I run ruby -v I get ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin18]. When I run chruby -V I get chruby: 0.3.9. After installing Jekyll with gem install jekyll I get Successfully installed jekyll-4.3.1 Parsing documentation for jekyll-4.3.1 Done installing documentation for Jekyll after 0 seconds 1 gem installed.
But when I run jekyll -v (or any Jekyll command) I get a very long message with the following error:
<internal:/Users/my_username/.rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle, 9): no suitable image found. Did find: (LoadError)
/Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle: cannot load 'protobuf_c.bundle' (load command 0x80000034 is unknown)
/Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle: cannot load 'protobuf_c.bundle' (load command 0x80000034 is unknown) - /Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle
I spent hours looking at what this error means and found very specific (to some version of Ruby or other libraries) questions like Ruby 2.7.2 google/protobuf_c problem (M1), Ruby: Gem version 3.11.2 doesn't load on Ruby 2.7, and many others.
It's the first time I even hear about Ruby or Jekyll or anything else here and I can't figure out how to properly install these to just make a website on GitHub. I also tried to install Ruby using rvm instead of chruby but that gave the same error. I also tried to install different versions of Ruby, like 3.1.3 and 3.2.0.
When gems have native extensions that need to be compiled it's possible for the gem author to build the extensions in advance and include them in the package so that the gem can install faster than if it were being compiled from scratch. Unfortunately Google has broken this implementation repeatedly.
This has been a problem for about two years with google-protobuf. Google has periodically fixed it and broken it again. They also periodically claim to understand the problem without understanding it and claim to have fixed it without fixing it. And their GitHub issues frequently pass the buck when they're the only ones that can fix it.
Anytime you're dealing with google-protobuf on macOS it's best to ensure that you are compiling it from scratch. This can be done with the --platform argument:
gem install --platform ruby google-protobuf
The platform ruby means don't use any pre-compiled binaries and force compilation from source.
The platform x86_64-darwin means use the pre-compiled binaries for macOS with Intel processors. That's the version that the gem installer identified for your system and used automatically but the error no suitable image found is a macOS error that means this library was not compiled in a way that I can understand.

Shopify CLI not recognising correct ruby install

When logging into a store with Shopify CLI I am given the following error:
"Your environment Ruby version, 2.6.3, is outside of the range supported by the CLI, 2.6.6..<3.2.0, and might cause incompatibility issues."
I am getting a general 'unexpected' error on a range of commands and believe it's due to the issue above. Thing is, I have latest ruby installed via homebrew, so it seems Shopify CLI is seeing another install.
I have tried reinstalling shopify-cli through homebrew using
brew reinstall shopify-cli
But this doesn't help.
If I run
ruby -v
I get the version mentioned in the error which shopify cli is seeing: "ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin21]"
Not sure if you fixed this, but I figured it out using this tool. Run brew config command, and look for the CLT: key: If it says >14.x, then you got an update from macOS v12.6 version. Please correct me if you think I might be wrong.
Just like a plus, update your Node package at least to v18.x. I hope that helps.

Error: You cannot use gems with Shopify CLI

I am new to Shopify theme development. Currently following the tutorial by Shopify. Everything was going smoothly but I am getting the following error every time I run "Shopify theme serve":
[Note] You cannot use gems with Shopify CLI.
[LoadError] cannot load such file -- wdm
They are disabled.
Please don't modify the CLI locally.
If you would like to contribute to the CLI project, please refer to
https://github.com/Shopify/shopify-cli/blob/main/.github/CONTRIBUTING.md
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
X You are not authorized to edit themes on banana-man-co.myshopify.com.
Make sure you are a user of that store, and allowed to edit themes.
Also, I know it says I am not authorized to edit themes but I am pretty sure that I am logged in as the admin. Anybody know how to fix this?
Run
gem install wdm
on the command prompt.
Then you won't see this issue but still see
X You are not authorized to edit themes on banana-man-co.myshopify.com.
Make sure you are a user of that store, and allowed to edit themes.
Follow Caution section on https://shopify.dev/themes/tools/cli/getting-started.
For arch linux where shopify-cli is installed using:
gem install shopify-cli
You need to install the Bundler:
gem install bundler
See more details in archlinux ruby wiki. Hope this helps someone.

Installing heroku client only, and not the other things

I am using RVM for my Ruby installations.
I recently encountered a problem installing the heroku toolbelt with it installing Ruby 1.9.1 on my actual system, which then rewriting environment variables, and breaking my ruby cli. I had to delete everything, reinstall RVM, reinstall gems, ect ect..
The point is, I wish to be able to use the heroku client, and possibly foreman, but I don't want the toolbelt trying to install git, and ruby 1.9.1 on my system.
I tried to do the gem install version, but it states that the gem is depreciated, and for me to install the toolbelt.
Any help will be greatly appreciated.
Thank you for all thoughtful answers.
Go to the Heroku CLI on github and download the tarball from the other setup. Extract the Tarball and move the resulting files under /usr/local/heroku. Add /usr/local/heroku/bin to your PATH. Ensure that Heroku gem is removed from any project gem files. Reload your terminal and the Heroku CLI should be working.
You can run which heroku from your project directory and you should get /usr/local/heroku/bin/heroku.
As it is self updating you should only need to do this once.
If you want Foreman just use the Gem version.
Git and Ruby will not be installed using this process.
Update: Heroku now have an install script for a standalone install of the Heroku Client without Foreman and Git.
On Windows, the Heroku Toolbelt installer offers a choice between Full Installation and Custom Installation. If you choose Custom, you can select which components you want to install.

Rails server command generates error report

When I used rails server command, found following errors in terminal. It shows that "could not find a JavaScript runtime". I am newbie in ROR and don't know to configure different files. I Google and found solutions of this problem 1 2 3. Still I am not getting the things. Please suggest some solutions.
Ruby and Rail versions on my system
Ruby version:- ruby 1.8.7 , Rails version:- Rails 3.2.6
I suppose you lack executable on your system/
Haven't you try to run gem install execjs or bundle install(from your project directory) in console?
UPDATE
Also visit execjs homepage and try instaling any of JS runtimes supported.
UPDATE 2
I was able to reproduce your error (with ruby 1.9.2). Just add gem 'therubyracer' to your Gemfile and run bundle install. For some weird reason ROR is not working out of the box on Ubuntu. See this and search for runtime word for more info.
PS
Please put your Gemfile here. This might help.
The error message also tells your to
See https://github.com/sstephenson/execjs for a list of available runtimes.
You have to install one of the JavaScript runtimes listed there:
therubyracer
therubyrhino
Node.js
Microsoft Windows Script Host
For Rails 3.2.6 I suggest to use Ruby 1.9.3. for better performance.

Resources