rails gkaminari: views bootstrap3 cannot run

Asked 2 months ago, Updated 2 months ago, 6 views

After deploying gem 'kaminari' in rails, to avoid conflicts with bootstrap3,
$rails g kaminari:views bootstrap3
However, I am troubled by the following error.If anyone knows how to deal with it, please let me know.

 rails g kaminari: views bootstrap3
1.0.1/lib/generators/kaminari/views_generator.rb:114:in `initialize': 
No such file or directory @rb_sysopen-
git/refs/heads/master (Errno::ENOENT)

I thought it would be solved if I downgraded the rails version instead of the latest version, so I set it to 5.0.4 or 5.0.2, but I got a similar error.I'm at a loss, and I'd appreciate it if you could comment if you know something or have similar errors...

(Note: Specify the version when rails new in the Rails tutorial.)

ruby-on-rails bootstrap rubygems

2022-09-30 13:47

2 Answers

situation organization:

If you look closely at the error message, you can see that the file that failed to perform the actual operation and its corresponding line are printed (file path: appropriate line format)


Also, the reason is that it does not exist while trying to open a file or directory

No such file or directory @rb_sysopen

However, if you actually open the file and look at the line, you can see that what you are trying to open is not a file or directory, but a URL...!!

So, if you edit before and after that directly, you may be able to avoid errors


After playing with it a little bit, when I added require'open-uri', the behavior changed to read the remote resources specified in the code
(around line 114, one line below defget_files_in_master)

Normally, you should write an issue or send a Pull Request to the GitHub repository, but if you want to skip it and solve it, it may be effective as a makeshift

(validated in Ruby 2.4.1, Rails 5.1.3)

2022-09-30 13:47

Introduced gem 'kaminari' in rails

I think I am using a bundleer, but

$bundle exec rails g kaminari:views bootstrap3

Would it be the same if

2022-09-30 13:47

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.