gem installed but 'rails' commands don't work
when I run any rails command like rails s
I get the following error:
Could not find diff-lcs-1.1.2 in any开发者_Python百科 of the sources
Try running bundle install
.
However, I already installed diff-lcs.
bundle show diff-lcs /opt/local/lib/ruby1.9/gems/1.9.1/gems/diff-lcs-1.1.2
I also see diff-lcs when I do a gem list
command
My GEM_HOME is /opt/local/lib/ruby1.9/gems/1.9.1
For reference, here's the contents of my Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0'
end
group :test do
gem 'rspec', '2.0.0'
gem 'webrat', '0.7.1'
end
And the output of which rails
is /usr/bin/rails
If you are using Rails 3, edit 'Gemfile' in the root of your rails app such that it contains
gem 'diff-lcs'
Then run 'bundle install' from the root of your rails app.
Type "gem env" on your terminal. Check the executable path. Verify that it's set correctly.
A bit late to the party, but I had the same problem (though with Apache and Phusion, but the solution could quite easily be the same). It turns out that though I set the GEM_PATH
in my .bashrc, the server evidently doesn't get the bash environment. I fixed it following the advice here, in particular creating the config/setup_load_paths.rb
file and adding the following line:
ENV['GEM_HOME']='/path/to/my/gems'
Same problem.
Still haven't found an ideal solution, but if you delete the 'spring' gem from your gemfile, you should at least get things up and running again.
精彩评论