Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rubocop cannot load such file -- rubocop-rails

I installed gem rubocop. When I run: command rubocop terminal respond:

longnguyen:~/RubyOnRails/project$ rubocop
cannot load such file -- rubocop-rails
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_loader_resolver.rb:15:in `require'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_loader_resolver.rb:11:in `each'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_loader.rb:45:in `load_file'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_loader.rb:86:in `configuration_from_file'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/config_store.rb:44:in `for'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/cli.rb:242:in `apply_default_formatter'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/lib/rubocop/cli.rb:50:in `run'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/exe/rubocop:13:in `block in <top (required)>'
/home/sun/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/sun/.rvm/gems/ruby-2.5.3/gems/rubocop-0.72.0/exe/rubocop:12:in `<top (required)>'
/home/sun/.rvm/gems/ruby-2.5.3/bin/rubocop:23:in `load'
/home/sun/.rvm/gems/ruby-2.5.3/bin/rubocop:23:in `<main>'
/home/sun/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
/home/sun/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'

Help me please !!!

like image 549
long nguyễn Avatar asked Jun 27 '19 06:06

long nguyễn


1 Answers

Seems like you have something like: require: rubocop-rails somewhere in your rubocop configuration files chain. But you have not included gem 'rubocop-rails' in your gemfile.

Please include gem 'rubocop-rails' in your gemfile and this should be resolved.

like image 167
Zia Ul Rehman Mughal Avatar answered Nov 08 '22 02:11

Zia Ul Rehman Mughal