安装gem但'rails'命令不起作用 [英] gem installed but 'rails' commands don't work

查看:131
本文介绍了安装gem但'rails'命令不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行像 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆