0

我想spring在我的 Rails 4.0.2 项目中使用 gem。

为了获得更多功能,我还添加了listengem。

不幸的是,在执行时rails c,加载程序会出现以下错误:

bi@nona:~/ror/prj$ rails c
/home/bi/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:224:in 
`block in replace_gem': can't activate listen (~> 1.0), already activated 
listen-2.4.0. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/watcher/listen.rb:1:in `<top (required)>'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/watcher.rb:17:in `require_relative'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/watcher.rb:17:in `watch_method='
    from /home/bi/Desktop/my_docs/Inbox/ror/soqqa/config/spring.rb:1:in `<top (required)>'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/commands.rb:39:in `require'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/commands.rb:39:in `<module:Spring>'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/commands.rb:3:in `<top (required)>'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/server.rb:18:in `require'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/server.rb:18:in `<top (required)>'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/run.rb:35:in `require'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/run.rb:35:in `block in boot_server'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/run.rb:34:in `fork'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/run.rb:34:in `boot_server'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/run.rb:18:in `call'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/command.rb:7:in `call'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/rails.rb:23:in `call'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client/command.rb:7:in `call'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/lib/spring/client.rb:23:in `run'
    from /home/bi/.rvm/gems/ruby-1.9.3-p429/gems/spring-1.0.0/bin/spring:31:in `<top (required)>'
    from bin/rails:9:in `load'
    from bin/rails:9:in `<main>'

顺便说一句,rails server运行正常。

我试图解决这个问题——删除了之前版本(0.7.3)的 listen gem 并发布了spring stop. 但它一直在抱怨。

4

1 回答 1

3

我有同样的问题,在你的Gemfile中 指定版本, 然后运行​​bundle install它应该可以工作。gem 'listen', '~> 1.0'

于 2014-01-20T08:25:41.183 回答