安装gem但'rails'命令不起作用 [英] gem installed but 'rails' commands don't work
问题描述
当我运行像 rails s
之类的任何rails命令时,出现以下错误:
无法找到差异-lcs-1.1.2在任何源中
尝试运行 bundle install
。
然而,我已经安装了diff-lcs。
bundle show diff-lcs
/opt/local/lib/ruby1.9/gems /1.9.1/gems/diff-lcs-1.1.2
当我执行<$ c时,我也会看到diff-lcs $ c> gem list 命令
我的GEM_HOME是/opt/local/lib/ruby1.9/gems/1.9.1
以下是我的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
其中rails
的输出是 / usr / bin / rails
如果您使用的是Rails 3,请在Rails应用程序的根目录中编辑'Gemfile'
gem'diff-lcs'
然后从您的rails应用程序的根目录运行bundle install。
when I run any rails command like rails s
I get the following error:
Could not find diff-lcs-1.1.2 in any 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.
这篇关于安装gem但'rails'命令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!