Agile Web Development with Rails 7: Creating a new Rails app with '--css tailwind' (solved)

On (PDF) p. 68 the command to create the depot app is given as:

rails new depot --css tailwind

When I run this, I get an exception listed in the output:

/Users/stephan/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:88:in `require': cannot load such file -- yard (LoadError)
  …/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:88:in `load_yard'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:163:in `setup'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:152:in `generate'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:63:in `block in generation_hook'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:52:in `each'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.27/lib/yard/rubygems/hook.rb:52:in `generation_hook'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/request_set.rb:311:in `block in install_hooks'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/request_set.rb:310:in `each'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/request_set.rb:310:in `install_hooks'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/request_set.rb:209:in `install'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:210:in `install_gem'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:226:in `block in install_gems'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:219:in `each'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:219:in `install_gems'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/commands/install_command.rb:167:in `execute'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/command.rb:323:in `invoke_with_build_args'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/command_manager.rb:180:in `process_args'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/command_manager.rb:149:in `run'
  …/.asdf/installs/ruby/3.1.0/lib/ruby/site_ruby/3.1.0/rubygems/gem_runner.rb:53:in `run'
  …/.asdf/installs/ruby/3.1.0/bin/gem:13:in `<main>'

And yet, the command ends in ‘Done in 234ms.’ with exit code 0.

The environment:

  • Ruby 3.1.0 installed with asdf
  • Rails 7.0.2
  • asdf 0.9.0
  • yard 0.9.27

So, calling yard from the command line directly works fine. It seems that the yard gem isn’t installed. In fact,

grep -in yar Gemfile

yields nothing and the exit code is 1.

Further observation: Creating a new Rails app without ‘–css tailwind’ doesn’t show this behaviour, i.e. it creates a new app without the exception.

Am I doing it wrong? Should the ‘–css tailwind’ cause ‘yard’ to be included in the Gemfile, but doesn’t?

Any input or help is appreciated.

I haven’t seen this before. Just sharing what I know (which at this point isn’t likely to be helpful):

Thanks for the input! It led me to the right direction.

After uninstalling the yard gem, creating a new Rails app worked fine.

Any any case, I’m not sure what to think of this. Is it a bug … somewhere?

Most likely a bug in tailwindcss-rails.

I figured (most of it) out: I had this in my .gemrc:

install: --rdoc --ri --document=yri
update: --rdoc --ri --document=yri

removing the --document=yri parts, also got rid of the exception.