【问题标题】:running guard throwing error跑卫投掷错误
【发布时间】:2014-06-02 16:02:28
【问题描述】:

Guard 在 Windows 7(64 位)上出现错误

社区成员您好,我是 ruby​​ 新手,我正在尝试学习 rspec,并正在使用 guard 运行 rspec 示例。

我正在尝试在发出命令之前运行一个简单的 rspec 示例(通过设置以下环境) 守望rspec资源

ruby-1.9.3p545
rspec-3.0.0
guard-2.6.2
guard-rspec-4.2.9

日志:

C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/adapter/windows.rb:21:in `rescue in usable?': undefined method `_log' for Listen::Adapter::Windows:Class (NoMethodError)
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/adapter/windows.rb:17:in `usable?'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/adapter.rb:32:in `each'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listn/adapter.rb:32:in `detect'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/adapter.rb:32:in `_usable_adapter_class'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/adapter.rb:20:in `select'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/listener.rb:252:in `_adapter_class'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/listener.rb:208:in `_init_actors'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/listener.rb:72:in `block in <class:Listener>'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/fsm.rb:175:in `instance_eval'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/fsm.rb:175:in `call'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/fsm.rb:127:in `transition_with_callbacks!'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/celluloid-0.15.2/lib/celluloid/fsm.rb:95:in `transition'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/listen-2.7.6/lib/listen/listener.rb:85:in `start'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.6.1/lib/guard/commander.rb:30:in `block in start'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.6.1/lib/guard/commander.rb:108:in `block in within_preserved_state'
    from <internal:prelude>:10:in `synchronize'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.6.1/lib/guard/commander.rb:105:in `within_preserved_state'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.6.1/lib/guard/commander.rb:26:in `start'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.6.1/lib/guard/cli.rb:107:in `start'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from C:/softwares/Ruby193/lib/ruby/gems/1.9.1/gems/guard-2.6.1/bin/guard:6:in `<top (required)>'
    from C:/softwares/Ruby193/bin/guard:23:in `load'
    from C:/softwares/Ruby193/bin/guard:23:in `<main>'

请提出这里有什么问题。 非常感谢您的帮助。

注意

【问题讨论】:

    标签: rspec guard


    【解决方案1】:

    我遇到了同样的问题。

    看来这可能是今天发布的 listen 版本 2.7.6 的问题。尝试手动安装listen 2.6.5:

    如果您使用捆绑器:

    gem 'listen', '2.7.5'
    

    如果您使用 ruby​​gems 安装:

    gem uninstall listen
    gem install listen -v 2.7.5
    

    编辑:对于任何谷歌员工,2.7.9 版现已发布,这使得这个答案过时了。

    【讨论】:

    • 谢谢紫舍。执行上述操作 gem uninstall listen gem install listen -v 2.7.5 不再给我与监听相关的错误,但我收到以下消息请将以下内容添加到您的 Gemfile 以避免轮询更改:如果 RbConfig 需要“rbconfig”: :CONFIG['target_os'] =~ /mswin|mingw|cygwin/i gem 'wdm', '>= 0.1.0' end
    • 如果我使用 ruby​​gems 安装
      我需要在哪里配置这个
    • @NBB,如果您不使用捆绑程序,请输入 gem install wdm
    • canton7 我尝试安装 wdm,但出现以下错误
      C:\bdd\demo3>gem install wdm Fetching: wdm-0.1.0.gem (100%) ERROR: Error installation wdm:“wdm”原生 gem 需要安装构建工具。请更新您的 PATH 以包含构建工具或从“rubyinstaller.org/downloads”下载 DevKit,并按照“github.com/oneclick/rubyinstaller/wiki/Development-Kit”处的说明进行操作
    • @NBB 您是否按照您发布的链接中的说明进行操作
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-28
    • 2018-12-10
    • 1970-01-01
    • 1970-01-01
    • 2014-07-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多