保护宝石错误

时间:2015-02-19 20:54:01

标签: ruby-on-rails ruby rspec rubygems

我试图初始化guard gem以使用rspec并获得错误。 重复此错误的简单方法(ruby 2.1.5,rails 4.1.8,Windows 7 x64):

  1. rails new sample_app
  2. 包括"宝石' guard-rspec' "在gemfile中
  3. 捆绑更新
  4. 捆绑安装
  5. 捆绑exec guard init rspec
  6. 它应该写这样的东西:

      

    将新的Guardfile写入   / Users / mhartl / rails_projects / sample_app / Guardfile rspec guard添加到   Guardfile,随时编辑它

    生成 Guardfile 。 获得输出:

    D:\Programming\Projects\Ruby\Rails\sample_app>bundle exec guard init rspec
    D:/Programming/Programs/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/guard-2.12.2/bin/guard:18:in `spawn': Exec forma
    t error - D:/Programming/Programs/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/guard-2.12.2/bin/_guard-core (Errno::E
    NOEXEC)
            from D:/Programming/Programs/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/guard-2.12.2/bin/guard:18:in `ignor
    e_interrupts'
            from D:/Programming/Programs/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/guard-2.12.2/bin/guard:27:in `<top
    (required)>'
            from D:/Programming/Programs/RailsInstaller/Ruby2.1.0/bin/guard:23:in `load'
            from D:/Programming/Programs/RailsInstaller/Ruby2.1.0/bin/guard:23:in `<main>'
    

    没有生成文件。 Gemfile(rails new app + guard-rspec):

    &#13;
    &#13;
    source 'https://rubygems.org'
    
    gem 'guard-rspec'
    
    gem 'rails', '4.1.8'
    gem 'sqlite3'
    gem 'sass-rails', '~> 4.0.3'
    gem 'uglifier', '>= 1.3.0'
    gem 'coffee-rails', '~> 4.0.0'
    gem 'jquery-rails'
    gem 'turbolinks'
    gem 'jbuilder', '~> 2.0'
    gem 'sdoc', '~> 0.4.0',          group: :doc
    
    gem 'tzinfo-data', platforms: [:mingw, :mswin]
    &#13;
    &#13;
    &#13;

1 个答案:

答案 0 :(得分:0)

原来,后卫2.12.2 无效。我不得不从版本回滚到版本,最后 2.11.1 工作得很好。所以gemfile行看起来像这样:

...
  gem 'guard-rspec'
  gem 'guard', '2.11.1'
...