ruby-on-rails - ruby-rubocop 无法加载此类文件 -- rubocop/rspec/focused

标签 ruby-on-rails ruby rubygems rubocop rubocop-rspec

我已经为 VSCode 安装了 ruby​​-rubocop,并且 gem 安装了 rubocop,但是每次保存文件时,都会抛出这个错误:

    cannot load such file -- rubocop/rspec/focused
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_loader_resolver.rb:11:in `each'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_loader.rb:45:in `load_file'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_loader.rb:90:in `configuration_from_file'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_store.rb:54:in `for_dir'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/config_store.rb:44:in `for'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/target_finder.rb:180:in `block in process_explicit_path'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/target_finder.rb:179:in `reject'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/target_finder.rb:179:in `process_explicit_path'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/target_finder.rb:39:in `block in find'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/target_finder.rb:35:in `each'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/target_finder.rb:35:in `find'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/runner.rb:69:in `find_target_files'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/runner.rb:34:in `run'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli/command/execute_runner.rb:21:in `execute_runner'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli/command/execute_runner.rb:13:in `run'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli/command.rb:10:in `run'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli/environment.rb:17:in `run'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli.rb:65:in `run_command'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli.rb:72:in `execute_runners'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/lib/rubocop/cli.rb:41:in `run'
    /Library/Ruby/Gems/2.6.0/gems/rubocop-0.85.0/exe/rubocop:13:in `block in <top (required)>'

求助!我一直在努力完成这项工作,并在互联网上搜索解决方案,但还没有成功。

最佳答案

那个警察是 rubocop-rspec 的一部分插件,因此您可能还必须运行 gem install rubocop-rspec

关于ruby-on-rails - ruby-rubocop 无法加载此类文件 -- rubocop/rspec/focused,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62192330/

相关文章:

ruby-on-rails - 生成漂亮的:scaffold=> create_migration': wrong number of arguments (3 for 0) (ArgumentError`)时出错

ruby-on-rails - 在 rails/ruby 中创建 pdf 发票

Python打印环境变量内存地址

ruby-on-rails - 如何在不更改原始类的情况下替换 belongs_to 关联

ruby-on-rails - 是否可以将 MySQL 数据库转储到 seed.rb 文件中?

ruby-on-rails - 是否有用于查找/投票/讨论 ruby 的好网站?

rubygems - 在 git-flow 中使用 Bundler 的 rake release

ruby-on-rails - 错误:执行 gem 时 ... (Gem::FilePermissionError) 您没有/Library/Ruby/Gems/2.6.0 目录的写权限

ruby-on-rails - 带有符号的布局会产生错误

ruby - 无法为此处文档创建临时文件,使用 rvm 安装 ruby​​ 1.9.2