我从RVM切换到rbenv,它是插件。我的Gemfile很好,但是当我执行bundle install
,rbenv rehash
等并运行rack <whatever>
时,它找不到任何宝石。见下文。有人有什么想法吗?
Vanessas-MacBook-Pro:my-app vanessa$ rbenv versions
* 1.8.7-p352 (set by RBENV_VERSION environment variable)
1.9.2-p290
1.9.3-rc1
rbx-1.2.4
Vanessas-MacBook-Pro:my-app vanessa$ rbenv version
1.8.7-p352 (set by RBENV_VERSION environment variable)
Vanessas-MacBook-Pro:my-app vanessa$ more Gemfile
source 'http://rubygems.org'
gem "sinatra"
gem "god"
gem "rack", '1.2.3'
gem "activemodel", "~>3.0"
group :test do
gem "rake"
end
Vanessas-MacBook-Pro:my-app vanessa$ gem list
*** LOCAL GEMS ***
bundler (1.0.21)
rake (0.9.2.2)
redgreen (1.2.2)
rubygems-update (1.8.11)
Vanessas-MacBook-Pro:my-app vanessa$ rake test
/Users/vanessa/.rbenv/versions/1.8.7-p352/bin/ruby -I"lib:lib:test" -I"/Users/vanessa/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib" "/Users/vanessa/.rbenv/versions/1.8.7-p352/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb"
/Users/vanessa/.rbenv/versions/1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- rack/test (LoadError)
from /Users/vanessa/.rbenv/versions/1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
...
...
rake aborted!
Command failed with status (1): [/Users/vanessa/.rbenv/versions/1.8.7-p352/bin/...]
Tasks: TOP => test
(See full trace by running task with --trace)
Vanessas-MacBook-Pro:my-app vanessa$
答案 0 :(得分:4)
使用bundle exec
bundle exec rake test
答案 1 :(得分:0)
尝试在您的Gemfile中添加'rack-test'。