0

没有找到任何解决方案。当我require: cannot load such file -- guard/guard (LoadError)尝试启动 Rails 服务器时出现错误。

ruby -v
ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu]

rails -v
Rails 4.2.0

gem -v
2.2.2

那是我的宝石文件:

[...]
group :development, :test do
  gem "pry-rails"

  # Guard
  gem 'guard-rspec'
  gem 'guard-spinach'

  # Testing
  gem 'minitest'
  gem 'turn'
  gem 'capybara'
  gem 'rspec-rails'
  gem 'spinach-rails'
  gem 'libnotify'
  gem 'awesome_print'

  # Spring bindings
  gem 'spring'
  gem 'spring-commands-rspec'
  gem 'spring-commands-spinach'
end
[...]

并且运行开发服务器不起作用:

rails server
/home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/guard-spinach-0.0.3/lib/guard/spinach.rb:2:in `require': cannot load such file -- guard/guard (LoadError)
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/guard-spinach-0.0.3/lib/guard/spinach.rb:2:in `<top (required)>'
    from /var/lib/gems/2.1.0/gems/bundler-1.8.2/lib/bundler/runtime.rb:85:in `require'
    from /var/lib/gems/2.1.0/gems/bundler-1.8.2/lib/bundler/runtime.rb:85:in `rescue in block in require'
    from /var/lib/gems/2.1.0/gems/bundler-1.8.2/lib/bundler/runtime.rb:68:in `block in require'
    from /var/lib/gems/2.1.0/gems/bundler-1.8.2/lib/bundler/runtime.rb:61:in `each'
    from /var/lib/gems/2.1.0/gems/bundler-1.8.2/lib/bundler/runtime.rb:61:in `require'
    from /var/lib/gems/2.1.0/gems/bundler-1.8.2/lib/bundler.rb:134:in `require'
    from /home/sl/Dev/nexis-development-kit/nexis/config/application.rb:15:in `<top (required)>'
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/sl/Dev/nexis-development-kit/nexis/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

不过,当我注释掉它时,#gem 'guard-spinach'它工作正常。

我已经安装了我的宝石bundle install --path vendor/bundle

4

1 回答 1

0

这个没有简单的答案。

我想出了一些版本设置。可能,这不是最好的,但它有效。

group :development, :test do
  gem 'pry-rails'

  # Guard
  gem 'guard', '~> 2.2.4'
  gem 'guard-rspec', '~> 4.2.0'
  gem 'guard-spinach', '~> 0.0.2'
  gem 'rspec-rails', '~> 2.99'
  gem 'spinach-rails', '~> 0.2.1'

  # Testing
  gem 'minitest'
  gem 'turn'
  gem 'capybara'
  gem 'libnotify'
  gem 'awesome_print'

  # Spring bindings
  gem 'spring'
  gem 'spring-commands-rspec'
  gem 'spring-commands-spinach'
end
于 2015-02-21T18:34:21.883 回答