Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ruby 1.9.2, rails3.1.0, Why am I getting an error when I try to generate a scaffold.

Basically, When I try to generate a scaffold I am getting this error no such file to load -- openssl (LoadError) . The error is coming from

.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'

Not sure why this is happening. Here is the full error:

/home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
/home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': no such file to load -- openssl (LoadError)
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/rack-1.3.4/lib/rack/session/cookie.rb:1:in `<top (required)>'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/actionpack-3.1.0/lib/action_dispatch/middleware/session/cookie_store.rb:4:in `<top (required)>'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application/configuration.rb:125:in `const_get'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application/configuration.rb:125:in `session_store'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application.rb:168:in `block in default_middleware_stack'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application.rb:142:in `tap'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application.rb:142:in `default_middleware_stack'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/engine.rb:445:in `app'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `instance_exec'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/initializable.rb:25:in `run'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/initializable.rb:50:in `block in run_initializers'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `each'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application.rb:92:in `initialize!'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/spencer/Desktop/blog/config/environment.rb:5:in `<top (required)>'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application.rb:78:in `require'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!'
    from /home/spencer/.rvm/gems/ruby-1.9.2-p290@rails310/gems/railties-3.1.0/lib/rails/commands.rb:22:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
like image 882
Spencer Cooley Avatar asked Jan 28 '26 05:01

Spencer Cooley


2 Answers

OK so what I ended up doing is this.

  • uninstalled all version of ruby from rvm
  • deleted all of the gemsets from rvm
  • $ rvm pkg install openssl
  • $ rvm pkg install zlib
  • $ rvm install 1.9.2 --with-openssl-dir=$HOME/.rvm/usr --with-zlib-dir=$rvm_path/usr
  • reinstalled rails in a gemset

Everything works fine after that.

like image 200
Spencer Cooley Avatar answered Jan 30 '26 18:01

Spencer Cooley


You should be able to do something like this: (forgive the fact that there may be errors in my paths and I'm not on my linux box)

cd to ~.rvm/src/ruby-1.9.2-p290/ext/openssl
ruby extconf.rb
make
make install

Basically, just cd to the gem's source directory for your particular ruby version and rebuild/install this.

You will not need to rebuild ruby, this has been a common problem.

like image 36
Kyle d'Oliveira Avatar answered Jan 30 '26 20:01

Kyle d'Oliveira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!