Error: Could not load 'guard/go' or '~/.guard/templates/go' or find class Guard::Go

Error: Could not load 'guard/go' or '~/.guard/templates/go' or find class Guard::Go

我在 windows 中初始化 guard-go 时遇到问题。 其他插件工作正常,我可以使用 guard-sass.

详情 OS: Windows ruby:ruby 2.4.3p205(2017-12-14 修订版 61247)[x64-mingw32]

请查找详情

宝石文件

source "https://rubygems.org"

group:development do 
    gem 'guard'
    gem 'guard-go'
    gem 'win32console'
    gem 'guard-sass'
end

我已经使用 bundle install

安装了 gem

但是

bundle exec guard init go 抛出错误

11:04:08 - ERROR - Could not load 'guard/go' or '~/.guard/templates/go' or find class Guard::Go
 [#]

如果我手动添加插件代码到Guardfile

 guard 'go', :server => 'app.go' do
   watch(%r{\.go$})
 end

然后bundle exec guard给我一个错误,比如

11:10:45 - ERROR - Could not load 'guard/go' or find class Guard::Go
11:10:45 - ERROR - Error is: cannot load such file -- guard/guard
11:10:45 - ERROR - C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-go-0.0.4/lib/guard/go.rb:2:in `require'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-go-0.0.4/lib/guard/go.rb:2:in `<top (required)>'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:105:in `require'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:105:in `rescue in plugin_class'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:96:in `plugin_class'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/plugin_util.rb:56:in `initialize_plugin'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/internals/plugins.rb:26:in `add'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:185:in `block in guard'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:182:in `each'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:182:in `guard'
> [#] C:/Users/vaisr/Var23Workshop/Go/src/Prom/Guardfile:17:in `evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:377:in `instance_eval'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/dsl.rb:377:in `evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/guardfile/evaluator.rb:89:in `evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard.rb:134:in `_evaluate'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard.rb:49:in `setup'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/commander.rb:32:in `start'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/cli/environments/valid.rb:16:in `start_guard'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/cli.rb:122:in `start'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/aruba_adapter.rb:32:in `execute'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#] C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/guard-2.14.2/bin/_guard-core:11:in `<main>'
11:10:45 - ERROR - Invalid Guardfile, original error is:
> [#]
> [#] Could not load class: "Go",
> [#] backtrace:
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C

Github Issue 20

这是一些版本问题。一旦我们降级保护版本,它似乎就可以工作了。