简体   繁体   English

Chef:无法加载此类文件-rubocop / formatter / checkstyle_formatter

[英]Chef: cannot load such file — rubocop/formatter/checkstyle_formatter

I'm running the following command: 我正在运行以下命令:

rubocop --require rubocop/formatter/checkstyle_formatter --format RuboCop::Formatter::CheckstyleFormatter --no-color --silent --rails --out checkstyle.xml

And get this error: 并得到这个错误:

C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rubocop/formatter/checkstyle_formatter (LoadError)

Environment is Chef-DK 0.4.0 on Windows. 环境在Windows上为Chef-DK 0.4.0。 I've installed the gem with: 我已经用以下命令安装了gem:

gem install rubocop-checkstyle_formatter

RuboCop (0.28.0) is delivered within Chef-DK 0.4.0 and without Formater it is working. Chef-DK 0.4.0中随附提供了RuboCop(0.28.0),并且没有Formater的情况下仍在运行。

Here is the page of the Formater: https://github.com/eitoball/rubocop-checkstyle_formatter 这是格式化程序的页面: https : //github.com/eitoball/rubocop-checkstyle_formatter

I didn't find any solution by searching with google or here in stackoverflow. 我没有通过谷歌搜索或在stackoverflow中找到任何解决方案。 Any tipps how to fix or analyse the problem? 任何小费如何解决或分析问题? I'm new to Ruby. 我是Ruby的新手。

I solved this issue in a relatively hacky way but it works. 我以一种相对笨拙的方式解决了这个问题,但是它可以工作。 So basically cd into your rubocop gem folder (like /home/ec2-user/.rvm/gems/ruby-2.1.2/gems/rubocop-0.34.2/lib/rubocop), then you'll see a dir named formatter, then cd into that formatter folder, you'll see a bunch of .rb files for different formatters. 因此,基本上将CD放入您的rubocop gem文件夹(例如/home/ec2-user/.rvm/gems/ruby-2.1.2/gems/rubocop-0.34.2/lib/rubocop),然后您会看到一个名为formatter的目录,然后将其cd到该格式化程序文件夹中,您会看到一堆用于不同格式化程序的.rb文件。 Now here comes the solution. 现在是解决方案了。

touch checkstyle_formatter.rb

then copy https://github.com/eitoball/rubocop-checkstyle_formatter/blob/master/lib/rubocop/formatter/checkstyle_formatter.rb to the file you just created. 然后将https://github.com/eitoball/rubocop-checkstyle_formatter/blob/master/lib/rubocop/formatter/checkstyle_formatter.rb复制到您刚刚创建的文件中。

Then you should be good to go 那你应该很好

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 rubymine debug rspec未捕获的异常:无法加载此类文件-teamcity / spec / runner / formatter / teamcity / formatter - rubymine debug rspec Uncaught exception: cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter 在RubyMine中运行规范会导致“无法加载此类文件 - teamcity / spec / runner / formatter / teamcity / formatter(LoadError)” - Running a spec in RubyMine results in “cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError)” RSpec:无法加载此类文件 - teamcity / spec / runner / formatter / teamcity / formatter(LoadError) - RSpec: cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError) rubocop 无法加载此类文件 -- rubocop-rails - rubocop cannot load such file -- rubocop-rails LoadError:无法在运行命令rackup,ruby版本2.2.0和黄瓜2.1.0上加载此类文件— gherkin / formatter / json_formatter - LoadError: cannot load such file — gherkin/formatter/json_formatter , on running command rackup ,ruby version 2.2.0 and cucumber 2.1.0 以编程方式将 Rubocop 格式化程序与 stdin/stdout 集成 - Programmatically integrate Rubocop formatter with stdin/stdout Github Actions rubocop:无法加载此类文件——rubocop-rake - Github Actions rubocop: cannot load such file -- rubocop-rake ruby-rubocop 无法加载此类文件 — rubocop/rspec/focused - ruby-rubocop cannot load such file — rubocop/rspec/focused `require':无法加载此类文件-rspec / core / formatters / base_formatter(LoadError) - `require': cannot load such file — rspec/core/formatters/base_formatter (LoadError) VSCode Ruby RuboCop 格式化程序删除了重点规范 `fit` -> `it` - VSCode Ruby RuboCop formatter removes focused specs `fit` -> `it`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM