执行警卫时参数数量错误

时间:2016-03-16 14:21:11

标签: guard

我目前正在运行以下Guardfile

guard 'cucumber' do 
  watch(%r{^features/.+\.feature$})
  watch(%r{^features/support/.+$})          { 'features' }
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] }
end

运行后

> bundle exec guard --debug

我收到以下输出

13:59:55 - ERROR - Invalid Guardfile, original error is:
> [#] wrong number of arguments (2 for 1)
13:59:55 - ERROR - No guards found in Guardfile, please add at least one.
13:59:55 - DEBUG - Command execution: which notify-send
13:59:55 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
13:59:55 - INFO - Guard is using TerminalTitle to send notifications.
13:59:55 - DEBUG - Command execution: hash stty
13:59:55 - DEBUG - Guard starts all plugins
13:59:55 - INFO - Guard is now watching at '/opt/app'
13:59:58 - DEBUG - Start interacto

我使用Ruby 1.9.3p551,Rubygems是2.6.2,后卫1.8.3,后卫黄瓜2.0.0。

有什么可能是问题的建议吗?

1 个答案:

答案 0 :(得分:0)

升级到Guard 2.13.0(Guard 1.8.3已过时)。

可能是因为较旧的Guard需要一个符号,而不是一个字符串,所以这可以起作用:

guard :cucumber do