简体   繁体   English

使用RVM时如何安装Rails应用程序?

[英]How to install a Rails application when using RVM?

I've followed instructions from this question on SO to set up RVM, rubies and gem lists. 我遵循关于SO的此问题的说明来设置RVM,红宝石和宝石列表。

I have created rubies 1.8.7 and 1.9.3. 我创建了红宝石1.8.7和1.9.3。 For the ruby 1.8.7 I have created a gemset called Organisator. 对于红宝石1.8.7,我创建了一个名为Organisator的宝石集。

I have activated the 1.8.7 ruby and gemset "Organisator". 我已激活1.8.7红宝石和宝石“ Organisator”。

I navigated to the folder of my app and tried to run bundle install . 我导航到应用程序的文件夹,并尝试运行bundle install I assume that's how I'm supposed to install the gems needed for my app, same way I did when I did not have RVM. 我认为这就是我应该安装应用程序所需的gems的方式,就像没有RVM时一样。

Error message I get: 我收到错误消息:

root@user-VirtualBox:/home/user/RoR/testapp# bundle install
Fetching gem metadata from https://rubygems.org/.Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Please include the full output of the command, your Gemfile and Gemfile.lock. Thanks!
/usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- openssl (LoadError)
    from /usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/net/https.rb:102
    from /usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/net/http/persistent.rb:447:in `ssl'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/net/http/persistent.rb:216:in `connection_for'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/net/http/persistent.rb:358:in `request'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/fetcher.rb:135:in `fetch'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/fetcher.rb:163:in `fetch_dependency_remote_specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/fetcher.rb:122:in `fetch_remote_specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/fetcher.rb:70:in `specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/source.rb:234:in `remote_specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/source.rb:232:in `each'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/source.rb:232:in `remote_specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/source.rb:165:in `fetch_specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/source.rb:70:in `specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/lazy_specification.rb:53:in `__materialize__'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/spec_set.rb:86:in `materialize'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/spec_set.rb:83:in `map!'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/spec_set.rb:83:in `materialize'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/definition.rb:127:in `specs'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/definition.rb:122:in `resolve_remotely!'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/installer.rb:48:in `run'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/installer.rb:12:in `install'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/cli.rb:220:in `install'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/thor/task.rb:22:in `send'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/gems/bundler-1.1.2/bin/bundle:13
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/bin/bundle:19:in `load'
    from /usr/local/rvm/gems/ruby-1.8.7-p358@organizators/bin/bundle:19

I also get an error message when I try to create a new app: 尝试创建新应用时,我还会收到一条错误消息:

root@user-VirtualBox:/home/user/RoR# rails new testapp
/usr/lib/ruby/vendor_ruby/railties/lib/rails_generator.rb:30:in `require': no such file to load -- active_support (LoadError)
    from /usr/lib/ruby/vendor_ruby/railties/lib/rails_generator.rb:30
    from /usr/lib/ruby/vendor_ruby/railties/bin/rails:16:in `require'
    from /usr/lib/ruby/vendor_ruby/railties/bin/rails:16

I assume I've done something wrong when setting up RVM. 我假设设置RVM时做错了什么。 The only idea I have right now is installing all the gems from my gemfile and adding them to gemfile manually. 我现在唯一的想法是从我的gemfile安装所有gem,并将它们手动添加到gemfile。

Versions 版本号

  • Ruby 1.8.7-p358 Ruby 1.8.7-p358
  • Rails 2.3.1.4 Rails 2.3.1.4
  • RVM 1.10.3 RVM 1.10.3
  • Ubuntu 11.10 Ubuntu 11.10

please use the "quick fix" from here https://rvm.io/packages/openssl/ 请从这里https://rvm.io/packages/openssl/使用“快速修复”

you have to ignore the rest of instructions, they are intended for systems that do not support packages (like osx) 您必须忽略其余说明,它们是针对不支持软件包的系统(例如osx)的

Yes, you've missed openssl, type this, should work 是的,您错过了openssl,请键入它,应该可以

rvm pkg install openssl
rvm pkg install iconv
rvm remove 1.8.7
rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM