【问题标题】:Rubocop cant find inherit_gemRubocop 找不到 inherit_gem
【发布时间】:2018-01-26 08:42:00
【问题描述】:

从我的 rails 应用程序根目录运行 rubocop,并将 rubocop 配置为使用 inherit_gem 属性会出现错误;

Unable to find gem gem_name; is the gem installed? Gem::MissingSpecError

但是 gem 我确认 gem 安装在 bundler 和 Gemfile 中。

我错过了什么?

【问题讨论】:

  • 您是使用bundle exec rubocop 还是仅使用rubocop 运行它?
  • 刚刚rubocop我发布了一个刚刚有效的答案。

标签: ruby-on-rails ruby rubygems rubocop


【解决方案1】:

参考https://github.com/bbatsov/rubocop/blob/master/manual/configuration.md#inheriting-configuration-from-a-remote-url ,错误是因为inherit_gem 是通过bundler 安装的。所以rubocop 必须用像这样的捆绑器来调用;

$ bundle exec rubocop <options...>

【讨论】:

    猜你喜欢
    • 2019-04-21
    • 1970-01-01
    • 2018-10-28
    • 2019-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多