我想在我的Rails 4.0.2项目中使用spring
gem。
为了获得更多功能,我还添加了listen
gem。
不幸的是,在执行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
。但它一直在抱怨。
答案 0 :(得分:3)
我遇到了同样的问题,请在 Gemfile 中指定版本
gem 'listen', '~> 1.0'
然后运行捆绑安装,它应该可以正常工作。