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:inblock 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 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

On Mar 13, 2014, at 6:17 AM, Peter Heylin wrote:

    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/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

On Thursday, March 13, 2014 10:17:04 AM UTC, Peter Heylin wrote:

/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)

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

On Mar 13, 2014, at 1:12 PM, Peter Heylin wrote:

    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/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.

@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 methoddefault_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:inmodule: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:inrequire’
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:inrequire’
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:ineach’
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:inrequire’
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:inrequire’
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:intap’
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:inrequire’
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

Hi,

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

I found a commit in the Sprockets Github repo (
default_mime_type can just be a class method · sstephenson/sprockets@743c1b1 · GitHub)
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
or>': 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
:).

On 12 January 2015 at 16:51, Jason Fleetwood-Boldt
[email protected]

On Jan 12, 2015, at 11:00 AM, Serguei C. [email protected] wrote:

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 L. 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.

On 12 January 2015 at 17:30, Jason Fleetwood-Boldt
[email protected]

Hi,

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

I found a revision in the Sprockets Github repo
(default_mime_type can just be a class method · sstephenson/sprockets@743c1b1 · GitHub)
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

On 12 January 2015 at 16:30, Jason Fleetwood-Boldt
[email protected] wrote:

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.

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

On Mon, Jan 12, 2015 at 8:39 AM, Serguei C. [email protected]
wrote:

I think it comes outside the current topic because talking about
non-supporting of Rails on Windows is too vast

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:


Hassan S. ------------------------ [email protected]

twitter: @hassan

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
https://github.com/sstephenson/sprockets/issues/693 from Sprockets
repo
for the idea.

Cheers

That was my point exactly.

-Jason

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

On 13 January 2015 at 12:14, Serguei C. [email protected]
wrote:

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

On 13 January 2015 at 11:53, Javix [email protected] wrote:

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