質問

I wanted to use spring gem on my Rails 4.0.2 project.

To get further functionality, I added listen gem as well.

Unfortunately, when doing rails c, the loader gives the following error:

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>'

By the way, rails server runs alright.

I tried to fix the problem -- removed previous version (0.7.3) of listen gem and issued spring stop. But it keeps complaining.

役に立ちましたか?

解決

I had the same issue, specify the version in your Gemfile like gem 'listen', '~> 1.0' then run bundle install and it should work.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top