缺少 Rails gem 错误,但已安装! [英] Missing Rails gem error, but its installed!

查看:44
本文介绍了缺少 Rails gem 错误,但已安装!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我是 Rails 的新手,实际上是在学习 Lynda.com 的视频教程以学习它.我没有按照视频上的步骤进行安装,因为我听说过 RVM 并且到目前为止它在完成所有设置方面都很棒.但是我还处于视频的早期,无法通过一些非常简单的事情......所以我希望有人可以帮助我.

So I'm new to rails and am actually following a video tutorial from Lynda.com in order to learn it. I didn't follow the steps to install on the video because I heard of RVM and its been great so far with getting everything setup. But I'm still early on in the video and can't get passed something really simple... so I'm hoping someone can help me out.

这里有一些背景:

  • 我已经安装并创建了 RVM1.8.7@rails2.3.8.我能够同时安装 ruby​​ 和 rails,并且这里的一切都很好.我什至为 mysql 设置一个全局 gemset 和乘客.

  • I have RVM installed and created 1.8.7@rails2.3.8. I was able to install both ruby and rails, and everything here is fine. I even setup a global gemset for mysql and passenger.

我使用的是乘客而不是WEBrick(本教程使用的)和我什至能够获得 apache模块已加载,一切正常创建导轨时工作正常应用程序.我可以去 simple-cms.local 和我看看介绍页就好了.

I'm using passenger instead of WEBrick (which the tutorial uses) and I was even able to get the apache module loaded and everything is working fine when I create a rails app. I can go to simple-cms.local and I see the intro page fine.

所以问题来了.在观看视频时,我到了脚本/生成控制器说的地步,它创建的控制器很好,没有错误.然后我继续在控制器中定义一个动作hello",并在 app/view/say 文件夹中定义相应的视图hello.rhtml".

So here is the issue. While following the video, I got to the point where I script/generate controller say and it created the controller fine, no errors. I then proceeded to define an action "hello" in the controller, and the corresponding view "hello.rhtml" in the app/view/say folder.

现在,当我尝试访问 simple-cms.local 时,它仍然有效,但是当我尝试访问 simple-cms.local/say/hello.rhtml 时,出现错误!

Now, when I try to visit simple-cms.local, it still works, but when I try to visit simple-cms.local/say/hello.rhtml, I get an error!

Ruby on Rails 应用程序无法开始

Ruby on Rails application could not be started

应用程序已退出启动(即在评估配置/环境.rb).错误消息可以在下面找到.解决这个问题,请关注任何错误消息中的说明.

The application has exited during startup (i.e. during the evaluation of config/environment.rb). The error message can be found below. To solve this problem, please follow any instructions in the error message.

错误信息:缺少 Rails 2.3.8宝石.请gem install -v=2.3.8rails,更新你的 RAILS_GEM_VERSION在 config/environment.rb 中设置您拥有的 Rails 版本已安装,或注释掉RAILS_GEM_VERSION 使用最新的已安装版本.

Error message: Missing the Rails 2.3.8 gem. Please gem install -v=2.3.8 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

那我在这里做什么?我的意思是安装了 rails 2.3.8,为什么还提示我重新安装?

So what do I do here? I mean rails 2.3.8 is installed, so why is it telling me to install it again?

更新:

我从应用程序目录中运行 gem environment 并得到这个

I ran gem environment from within the app directory and got this

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.4.0]
  - INSTALLATION DIRECTORY: /Users/user/.rvm/gems/ruby-1.8.7-p302@rails2
  - RUBY EXECUTABLE: /Users/user/.rvm/rubies/ruby-1.8.7-p302/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/user/.rvm/gems/ruby-1.8.7-p302@rails2/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /Users/user/.rvm/gems/ruby-1.8.7-p302@rails2
     - /Users/user/.rvm/gems/ruby-1.8.7-p302@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

然后运行 ​​script/console,它工作,然后运行 ​​Gems.path,它返回

Then ran script/console, which worked and then ran Gems.path, which returned

["/Users/user/.rvm/gems/ruby-1.8.7-p302@rails2", "/Users/user/.rvm/gems/ruby-1.8.7-p302@global"] 

我觉得很好,你们呢?

更新 2:

好的,对我来说没有任何效果!我还没有尝试过Passenger Standalone,但我需要使用apache,我读到standalone 使用nginx.到目前为止我尝试的都是从头开始,rvm implode 然后再次安装rvm,ruby 1.8.7,passenger,mysql,rails 2.3.8,仅此而已.访问我的应用程序时,我仍然无法通过默认页面!然后,我还尝试按照 Chris Johnsen 在评论中链接的指南进行操作,但无济于事.

Ok, so nothing has worked for me! I haven't yet tried Passenger Standalone, but I need to use apache and I read that standalone uses nginx. What I tried so far is started from scratch, rvm implode and then installed rvm again, ruby 1.8.7, passenger, mysql, rails 2.3.8, and thats it. I still can't get passed the default page when visiting my app! I also then tried following the guides Chris Johnsen linked to in the comments to no avail.

欢迎所有想法...

推荐答案

问题是我正在将乘客安装到全局 gemset 中,这应该不是问题,但确实如此.

The issue was that I was installing passenger into the global gemset, which shouldn't be a problem, but it was.

我从全局 gemset 中卸载了乘客,并将其安装到我正在使用的项目 gemset 中.这解决了丢失的 rails gem 错误,现在我在尝试访问 simple-cms.local/say/hello 时收到 500 错误.我将为此创建一个新问题并标记此问题已解决!

I uninstalled passenger from the global gemset, and installed it into the project gemset that I'm using. This solved the missing rails gem error, and now I'm getting a 500 error when trying to visit simple-cms.local/say/hello. I'll create a new question for that and mark this one solved!

这篇关于缺少 Rails gem 错误,但已安装!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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