Starting rails server

Hi,

My apologies if a similar topic exists already. I did search, but could not find anything related to below.

I am new to Ruby on Rails. I am currently setting up a Ruby on Rails environment on a CentOS 6.4 64-bit server.

When I attempt to start the rails server, I get the following:

/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.3/lib/active_support/key_generator.rb:2:in `require’: cannot load such file – openssl (LoadError)

    from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.3/lib/active_support/key_generator.rb:2:in `<top (required)>'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/application.rb:3:in `require'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/application.rb:3:in `<top (required)>'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails.rb:9:in `require'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails.rb:9:in `<top (required)>'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:1:in `require'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:1:in `<top (required)>'

    from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `require'

    from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `<top (required)>'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `require'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'

    from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'

    from bin/rails:4:in `require'

    from bin/rails:4:in `<main>'

Would anyone have any advice or suggestions that might help to steer me in the right direction with regard to resolving the above error.

Thanks in advance,

Peter

Hi,

My apologies if a similar topic exists already. I did search, but could not find anything related to below.

I am new to Ruby on Rails. I am currently setting up a Ruby on Rails environment on a CentOS 6.4 64-bit server. When I attempt to start the rails server, I get the following:

/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.3/lib/active_support/key_generator.rb:2:in `require': cannot load such file -- openssl (LoadError)         from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.0.3/lib/active_support/key_generator.rb:2:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/application.rb:3:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/application.rb:3:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails.rb:9:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails.rb:9:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:1:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:1:in `<top (required)>'         from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `require'         from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'         from bin/rails:4:in `require'         from bin/rails:4:in `<main>'

Would anyone have any advice or suggestions that might help to steer me in the right direction with regard to resolving the above error.

At a glance, have you confirmed that openSSL is installed in the location where the gem expects it? Also, how did you install Ruby on this machine? (Package, source compile, ?)

Walter

That sounds like ruby’s openssl bindings are missing. Make sure then openssl development headers (i think on centos that would be the openssl-devel package) are installed before you install ruby. You can build those extensions after ruby has been installed but it’s probably easier just to reinstall ruby

Fred

@Walter - I have installed Ruby via the source compile method. I am using Ruby 2.1.1 and RubyGems 2.2.2

@all - I have just installed the package openssl-devel and re-compiled Ruby. This has gotten rid of the error relating to Open SSL.

I am now getting a different error when I attempt to start the rails server.

/usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/jst_processor.rb:5:in <class:JstProcessor>': undefined method default_mime_type=’ for Sprockets::JstProcessor:Class (NoMethodError)

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/jst_processor.rb:4:in `module:Sprockets

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/jst_processor.rb:3:in `<top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/engines.rb:3:in `require’

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/engines.rb:3:in `<top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets.rb:44:in `require’

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets.rb:44:in `module:Sprockets

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets.rb:3:in `<top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.0.1/lib/sprockets/railtie.rb:5:in `require’

from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.0.1/lib/sprockets/railtie.rb:5:in `<top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:11:in `require’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:11:in `block in <top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:9:in `each’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:9:in `<top (required)>’

from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `require’

from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `<top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `require’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap’

from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>’

from bin/rails:4:in `require’

from bin/rails:4:in `’

Would anyone know what might be causing this and what I might have to do to resolve it?

Thanks,

Peter

@Walter - I have installed Ruby via the source compile method. I am using Ruby 2.1.1 and RubyGems 2.2.2

@all - I have just installed the package openssl-devel and re-compiled Ruby. This has gotten rid of the error relating to Open SSL. I am now getting a different error when I attempt to start the rails server.

/usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/jst_processor.rb:5:in `<class:JstProcessor>': undefined method `default_mime_type=' for Sprockets::JstProcessor:Class (NoMethodError)         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/jst_processor.rb:4:in `<module:Sprockets>'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/jst_processor.rb:3:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/engines.rb:3:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets/engines.rb:3:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets.rb:44:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets.rb:44:in `<module:Sprockets>'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-2.11.0/lib/sprockets.rb:3:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.0.1/lib/sprockets/railtie.rb:5:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.0.1/lib/sprockets/railtie.rb:5:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:11:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:11:in `block in <top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:9:in `each'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/all.rb:9:in `<top (required)>'         from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `require'         from /root/Documents/ruby/rubyonrails/blog/config/application.rb:3:in `<top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `require'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'         from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'         from bin/rails:4:in `require'         from bin/rails:4:in `<main>'

Would anyone know what might be causing this and what I might have to do to resolve it?

Have you installed a JS runtime, like 'therubyracer' or 'nodejs', on your server?

Walter

Thanks for the reply.

I have just installed therubyracer and the error remains.

nodejs is not installed on the server.

Hi,

I got it sorted. Here is what I did to fix it:

I found a commit in the Sprockets Github repo (https://github.com/sstephenson/sprockets/commit/743c1b1a6433195e440e2d863e5d4767cc41271a) when searching for a fix for the undefined method error relating to default_mime_type. I then applied this change to the following ruby scripts in the sprockets 2.11.0 gem directory: jst_processor, sass_compressor, closure_compressor, uglifier_compressor, sass_template, scss_template.

I then edited my GemFile to activate therubyracer within my gem environment.

Thanks for your assistance.

Peter

Hi guys, I have the same problems: I can’t figure out why I have the following error when trying to run rails s on a Windows 7 x64 box:

C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets/jst_processor.rb:5:in `<class:JstProcess
>': undefined method `default_mime_type=' for Sprockets::JstProcessor:Class (NoMethodError)
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets/jst_processor.rb:4:in `<mod
ule:Sprockets>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets/jst_processor.rb:3:in `<top
 (required)>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets/engines.rb:3:in `require'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets/engines.rb:3:in `<top (requ
ired)>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets.rb:44:in `require'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets.rb:44:in `<module:Sprockets
>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-2.12.3/lib/sprockets.rb:3:in `<top (required)>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:5:in `requi
re'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:5:in `<top
(required)>'
        from c:/Users/ZFTC0418/Documents/projects/rails_draft/config/application.rb:10:in `require'
        from c:/Users/ZFTC0418/Documents/projects/rails_draft/config/application.rb:10:in `<top (required)>'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in
`require'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in
`block in server'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in
`tap'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in
`server'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in
`run_command!'
        from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required
)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

Reproduced with the following configuration:

  • OS: Windows 7 x 64bits
  • Ruby ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]
  • sprockets version 2.12.3

The Gemfile has the line with therubyracer gem commented:

#gem 'therubyracer', platforms: :ruby

I have node.js installed:

node -v
v0.10.35

and node gem too:

node (0.0.2)

Any idea on how to fix that ? Thank you.

Javix,

ROR on Windows is basically unsupported (particularly on this list). The recommend path for you is to virtualize Ubuntu inside of you Windows setup and run ROR in Ubuntu.

-Jason

Thank you, Jason, for your response.

It is totally false about Rais is not supported on Windows.

I managed to code in RoR on multiples Windows boxes without any problem. Virtualizing it with VirtualBox or something else would be a real overkill :).

Thank you, Jason, for your response.

It is totally **false **about Rais is not supported on Windows.

Who provides that support? I’ve been on this list for several years and every time someone comes to the list asking about ROR on Windows they got hostile responses. It’s possible to do, but it is not supported by this forum. That’s what I meant by “unsupported”

I managed to code in RoR on multiples Windows boxes without any problem. Virtualizing it with VirtualBox or something else would be a real overkill :).

Really, you are like the 12th person in the last 6 months who has asked every time someone asks Colin Law always gives the same answer: Virtualize Ubuntu if you want to run ROR on Windows.

-Jason

I think it comes outside the current topic because talking about non-supporting of Rails on Windows is too vast, - rails (as gem ) depends on multiple gems; Most of them propose OS-dependent versions, including Windows.

I’m talking about sprockets gem and rails.

Thank you, Jason, for your response. It is totally false about Rais is not supported on Windows.

Who provides that support? I’ve been on this list for several years and every time someone comes to the list asking about ROR on Windows they got hostile responses. It’s possible to do, but it is not supported by this forum. That’s what I meant by “unsupported”

I don't think it is true to say that hostile responses are given, I think it is more a matter of pointing out that most rails developers use Linux or Mac and getting support for windows problems will be more difficult.

I managed to code in RoR on multiples Windows boxes without any problem. Virtualizing it with VirtualBox or something else would be a real overkill :).

Really, you are like the 12th person in the last 6 months who has asked every time someone asks Colin Law always gives the same answer: Virtualize Ubuntu if you want to run ROR on Windows.

Or dual boot Win and Ubuntu (my preferred route), or of course run windows in VM inside Ubuntu for the rare occasions you absolutely need windows.

Colin

Perfect. Two posts asserting that Rails on Windows is "supported", zero posts actually *supporting the Windows user with the problem*.

Sounds about right :slight_smile:

That was my point exactly.

-Jason

The problem is that I had to download and install all the Rails related gems and their dependencies separately because of firewall and proxi restricitions (it was a real headache). The problem was due to the tilt version (1.1) in the generated Gemfile.lock file; After deleting that file and re-running bundle install --local

``

everything came to normal and rails s

``

comand worked without any problems. Unfortuantely, nobody of the above responders had the idea to do that. Thank s to Josh from Sprockets repo for the idea.

Cheers

The problem is that I had to download and install all the Rails related gems and their dependencies separately because of firewall and proxi restricitions (it was a real headache). The problem was due to the tilt version (1.1) in the generated Gemfile.lock file; After deleting that file and re-running bundle install --local

everything came to normal

What version of tilt are you seeing in Gemfile.lock now?

Colin

1.1 see Gemfile.lock before: https://gist.github.com/Javix/efa6192ae995e89db950

1.4.1 after see Gemfile.lock after: https://gist.github.com/Javix/1430ae66cfca2aa3a6f9

1.1 see Gemfile.lock before: https://gist.github.com/Javix/efa6192ae995e89db950 1.4.1 after see Gemfile.lock after: https://gist.github.com/Javix/1430ae66cfca2aa3a6f9

How did it get to be 1.1 in the first place, which is an ancient version from 2010? Are you upgrading an existing app, or possibly the app was initially created with an old version of rails?

Colin

No, I didn’t upgrade the app. As I explained previously, I had to download all the gems and install them locally one by one. Some of them were dependent on 1.1, that’s why I had to install it instead of 1.4.1.