Rubymine - 未找到 Rails gem
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11418408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Rubymine - Rails gem not found
提问by Alexandre
I installed Rails 3.2.3 and Ruby 1.9.3 going through this solution - http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/. It's really amazing and effortless. There were no errors while I did this.
我通过这个解决方案安装了 Rails 3.2.3 和 Ruby 1.9.3 - http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/。这真的很棒而且毫不费力。我这样做时没有错误。
Now I try to create a Rails project in Rubymine 4 but there's an error: "Rails version - no Rails gem found".
现在我尝试在 Rubymine 4 中创建一个 Rails 项目,但出现错误:“Rails 版本 - 未找到 Rails gem”。
Terminal shows me:
终端显示我:
alex@ubuntu:~$ rails -v
Rails 3.2.3
alex@ubuntu:~$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
alex@ubuntu:~$
UPDATE
更新
alex@ubuntu:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/alex/.rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /home/alex/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /home/alex/.rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/alex/.rvm/gems/ruby-1.9.3-p194
- /home/alex/.rvm/gems/ruby-1.9.3-p194@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
alex@ubuntu:~$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.4)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
json (1.7.3)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12)
rubygems-bundler (1.0.3)
rvm (1.11.3.5)
sprockets (2.1.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
alex@ubuntu:~$
回答by Pritesh Jain
This may help for rubymine.
这可能有助于红宝石。
You need to add ruby sdks
您需要添加 ruby sdks
In RubyMine from file -> settings -> ruby Sdk and Gems -> add sdk
在 RubyMine 中从文件 -> 设置 -> ruby Sdk 和 Gems -> 添加 sdk
You can add multiple ruby version sdks and its gems
您可以添加多个 ruby 版本的 sdks 及其 gems
You can edit project specific ruby setup after starting project from menu
从菜单启动项目后,您可以编辑项目特定的 ruby 设置
run -> edit configuration -> ruby sdk (select specific rails environment)
运行 -> 编辑配置 -> ruby sdk(选择特定的 rails 环境)
$ which ruby #to get current ruby path
回答by Hugo Logmans
For posterity: don't select a Ruby version from the wrappers folders that are generated by rvm. Ruby thinks it's OK, but you get the Rails error.
对于后代:不要从 rvm 生成的 wrappers 文件夹中选择 Ruby 版本。Ruby 认为没问题,但是您收到了 Rails 错误。
回答by Kokizzu
When gem installed locally, just add the path to the SDK:
本地安装gem时,只需要添加SDK的路径即可:
for example: ~/.gem/ruby/2.2.0/gemson File> Project Settings> Platform Settings> SDKs> Classpath(press +button)
例如:~/.gem/ruby/2.2.0/gems开File> Project Settings> Platform Settings> SDKs> Classpath(按下+按钮)
回答by George
When you close and open again you will get a notification saying:
当您关闭并再次打开时,您会收到一条通知:
RubyMine Gem Manager: RubyMine has detected that some of the gems required for 'projectName' are not installed. Install
RubyMine Gem Manager:RubyMine 检测到未安装“projectName”所需的某些 gem。安装
Click Installand it will run the bundle install for the project, all got solved after that.
单击Install它将运行该项目的捆绑安装,之后一切都解决了。

