问题
I am running Ubuntu 10.04 on a linode trying to get sinatra, passenger, nginx, and rvm to all play nice with Ruby 1.9.2. I'm running into an issue with gems though:
~/.rvm/gems/ruby-1.9.2-p290/gems$ ls returns
daemon_controller-0.2.6 fastthread-1.0.7 passenger-3.0.9 rack-1.3.2 rake-0.9.2
and gem list returns
*** LOCAL GEMS ***
rack (1.3.2)
rake (0.9.2)
sinatra (1.2.6)
tilt (1.3.3)
What is odd to me is that they aren't the same. And sinatra is missing from the .rvm gems.
When I go to my website I get the following:
Error message:
no such file to load -- sinatra
with /home/noahc/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb on line 36 inrequire'`
Any ideas? Thanks!
回答1:
It seems that you have a problem with your rvm gemset not beeing used.
First, cd /yourprojectdir and create a .rvmrc and matching gemset for your project
rvm --rvmrc --create 1.9.2@yourprojectname
Then make sure you are using the gemset
rvm gemset list
The arrow should point to your gemset, if it's not do rvm gemset use yourprojectname.
Now install your gems with gem install, or - better - bundle install.
Passenger 3 should detect your .rvmrc and use the correct gemset automatically.
来源:https://stackoverflow.com/questions/7310050/sinatra-gem-wont-install