rails服务器不能与我合作,当我运行rails s -p 3005
时,我收到以下错误:
Please report a bug if this causes problems.
/home/badrit-user/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated minitest 5.5.1, but your Gemfile requires minitest 4.7.5. Using bundle exec may solve this. (Gem::LoadError)
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/setup.rb:7:in `<top (required)>'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
from /home/badrit-user/work/seeloz_mobile/config/boot.rb:4:in `<top (required)>'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:42:in `block in exec_app_rails'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:32:in `loop'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:32:in `exec_app_rails'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/gems/railties-4.1.8/lib/rails/cli.rb:5:in `<top (required)>'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /home/badrit-user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/gems/railties-4.1.8/bin/rails:9:in `<top (required)>'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/bin/rails:23:in `load'
from /home/badrit-user/.rvm/gems/ruby-2.0.0-p247@seeloz_mobile/bin/rails:23:in `<main>'
我检查了我的Gemfile.lock,我已经minitest (4.7.5)
了。
很奇怪,如果我运行这个bundle exec rails s -p 3005
,它就会运转,那么为什么会这样?
解决此问题的解决方案是什么? (使用rails s
)
答案 0 :(得分:2)
Using bundle exec may solve this.
中看到的那样
bundle exec rails s -p 3005
很奇怪,如果我运行这个
bundle exec rails s -p 3005
,它就会工作, 那么为什么会这样?
在开始时使用bundle exec
运行命令,启动gem从应用程序目录中安装Gemfile的内容,没有bundle exec
它运行安装在系统中的gem。如您所见,您已成功在系统中安装了minitest 5.5.1
,在Gemfile中安装了minitest 4.7.5
。
答案 1 :(得分:1)
如果你还没有使用捆绑器的binstubs与RVM集成,你应该试一试!
这意味着您不必再次键入bundle exec
。
设定:
chmod +x $rvm_path/hooks/after_cd_bundler
bundle install -—binstubs