[英]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.