Skip to content

Cannot install with Rails 8.0.1 #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iangullo opened this issue Mar 5, 2025 · 12 comments · Fixed by #239
Closed

Cannot install with Rails 8.0.1 #226

iangullo opened this issue Mar 5, 2025 · 12 comments · Fixed by #239

Comments

@iangullo
Copy link

iangullo commented Mar 5, 2025

Hello there.

I was really looking forward to using RubyUI after reading about it but... I can't seem to make it install!

Observed problems:

  1. Following installation steps according to RubyUI documentation, command to install fails: bin/rails g ruby_ui:installis not recognised as a valid command. Apparently, files installed are using rbui as parent symbol instead of ruby_ui --> advisable to update documentation
  2. Upon attempting to execute bin/rails g rbui:installprocess also fails claiming:

Add rbui initializer
Could not find "base_store_initializer.rb" in any of your source paths. Your current source paths are:
/mnt/users/argos/Documentos/Code/MensaGes/vendor/bundle/ruby/3.4.0/gems/ruby_ui-1.0.0.pre.alpha.4/lib/generators/rbui/install/templates

What am I missing?

Environment: OS: Debian 12. Ruby 3.4.2, Rails 8.0.1. arm64 platform (Raspberry Pi5). TEste with no luck on amd64 station with no luck.

@AcclaimedAP
Copy link

Hey!

I experienced the same issue, but I fixed it by changing the Gemfile from:
gem "ruby_ui", "~> 1.0.0.pre.alpha.4", :group => :development, :require => false
to
gem 'ruby_ui', '1.0.0.beta1', :group => :development, :require => false

(And then do bundle install)

It seems to be fixed in the latest release, but running the bundle add ruby_ui command does not give you that version.

@iangullo
Copy link
Author

iangullo commented Mar 8, 2025

Tried that solution but it did not work:
% bin/rails g ruby_ui:install

Checking for phlex-rails
phlex-rails is already installed
Checking for tailwind_merge
tailwind_merge is already installed
Creating RubyUI initializer
Could not find "ruby_ui.rb.erb" in any of your source paths. Your current source paths are:
/mnt/users/argos/Documentos/Code/MensaGes/vendor/bundle/ruby/3.4.0/gems/ruby_ui-1.0.0.beta1/lib/generators ruby_ui/install/templates

@AcclaimedAP
Copy link

Seems it is at least having another error now. Could give it a try to do one of the manual installations?

The source path it is looking for, I don't quite have that myself(install folder has a install_generator.rb file only). I installed it on windows with WSL, so I thought most of my issues were related to that ,but might be just something weird overall, but manual worked fine in the end for me.

@iangullo
Copy link
Author

iangullo commented Mar 9, 2025

Tried that just now. Completed all the steps listed in "Manual installation" but tying to create a component fails:
No such file or directory @ rb_check_realpath_internal - /Code/MensaGes/vendor/bundle/ruby/3.4.0/gems/ruby_ui-1.0.0.beta1/lib/generators/ruby_ui/dependencies.yml (Errno::ENOENT)

Tried to execute rails g ruby_ui:install with no luck either.
Could not find "ruby_ui.rb.erb" in any of your source paths.

I've hit a dead end. If you do fix this, I'll be happy to adopt the component. For the moment, I will stick wwith regular ViewComponents built by myself from scratch.

Thanks for the effort anyways!

@AcclaimedAP
Copy link

Sadly have no other guess then, I know I get an error when I try to generate a component as well, however it still generates it properly(as far as I can see). My personal experience has been complex as well, and I would not push to use this in production anytime soon. Hopefully these hiccups are fixed soon enough.

Perhaps some maintainer could shed some lights as well.

@vgoyette
Copy link

vgoyette commented Mar 15, 2025

I'll second this issue. On Mac M4 Pro, Sequoia 15.1, Ruby 3.3.6, Rails 8.0.2. Tried following the documentation and got to the instal; on run, got the following:

>> `rails g ruby_ui:install`                                                                                                                                           
Could not find generator 'ruby_ui:install'. (Rails::Command::CorrectableNameError)
Did you mean?  rbui:install
Run 'bin/rails generate --help' for more options

I tried running the suggested command (rails g rbui:install) and got the following:

>> rails g rbui:install
[WARNING] Could not load generator "generators/rbui/install/install_generator". Error: uninitialized constant RBUI::Generators::BaseGenerator.

Edit: Also tried the fix mentioned by @AcclaimedAP and got the same Could not find "ruby_ui.rb.erb" in any of your source paths. error.

@paul
Copy link

paul commented Mar 22, 2025

I've run in to the same issue. I think the problem is here: https://github.com/ruby-ui/ruby_ui/blob/main/ruby_ui.gemspec#L10

When I list the files in the generator directory, there's no templates folder, just the install_generator.rb:

$ ls .../ruby/3.4.2/lib/ruby/gems/3.4.0/gems/ruby_ui-1.0.0.beta1/lib/generators/ruby_ui/install
install_generator.rb

The gemspec is only adding .rb, .yml and .rake files to the gem package, so the .erb files for the generator templates aren't getting included. Compare to something like phlex-rails, which grabs everything in lib.

@sdhull
Copy link
Contributor

sdhull commented Mar 24, 2025

@paul good find! PR to include erb files in the gem distro #234

@paul
Copy link

paul commented Mar 24, 2025

Looks like its missing dependencies.yml in the packaged gem files, too https://github.com/ruby-ui/ruby_ui/blob/main/lib/generators/ruby_ui/dependencies.yml

$ rails g ruby_ui:component DropdownMenu
Generating component files
Generating main component
      create  app/components/ruby_ui/dropdown_menu.rb
Generating related components
      create  app/components/ruby_ui/dropdown_menu/dropdown_menu_content.rb
      create  app/components/ruby_ui/dropdown_menu/dropdown_menu_item.rb
      create  app/components/ruby_ui/dropdown_menu/dropdown_menu_label.rb
      create  app/components/ruby_ui/dropdown_menu/dropdown_menu_separator.rb
      create  app/components/ruby_ui/dropdown_menu/dropdown_menu_trigger.rb
...ruby/3.4.2/lib/ruby/gems/3.4.0/gems/bootsnap-1.18.4/lib/bootsnap/compile_cache/yaml.rb:234:in 'File.realpath': No such file or directory @ rb_check_realpath_internal - .../3.4.2/lib/ruby/gems/3.4.0/gems/ruby_ui-1.0.0.beta1/lib/generators/ruby_ui/dependencies.yml (Errno::ENOENT)

@paul
Copy link

paul commented Mar 24, 2025

...and the component js files, like https://github.com/ruby-ui/ruby_ui/blob/main/lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js

@Olgagr
Copy link

Olgagr commented Apr 16, 2025

Is this issue fixed now? I still have the original issue. Following the instructions on the webpage (https://rubyui.com/docs/installation/rails_importmaps), the gem is installed in 1.0.0.pre.alpha.4 version. When I run bin/rails g ruby_ui:install I get the error:

Could not find generator 'ruby_ui:install'. (Rails::Command::CorrectableNameError)
Did you mean?  rbui:install
Run `bin/rails generate --help` for more options.

I'm on Rails 8.0.1 and Ruby 3.3.0

@stephannv
Copy link
Contributor

Is this issue fixed now? I still have the original issue. Following the instructions on the webpage (https://rubyui.com/docs/installation/rails_importmaps), the gem is installed in 1.0.0.pre.alpha.4 version. When I run bin/rails g ruby_ui:install I get the error:

Could not find generator 'ruby_ui:install'. (Rails::Command::CorrectableNameError)
Did you mean?  rbui:install
Run `bin/rails generate --help` for more options.

I'm on Rails 8.0.1 and Ruby 3.3.0

Yeah, the fix is on main but we didn't release it yet. You will need to add to your Gemfile something like gem "ruby_ui", github: "ruby-ui/ruby_ui" for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants