1

I'm working through the tutorial on Lynda Ruby on Rails 4 Essential Training and all has gone well until i have to type: rails server

I have already seen Ruby on Rails - cannot load such file — mysql2/2.2/mysql2 (LoadError) and this does not solve my problem i still have the very same error.

Then this large error comes up:-

C:\Users\Caroline\Sites\simple_cms>rails server
C:/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-
mingw32/lib/mysql2/mysql2.r
b:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/my
sql2/mysql2.rb:2:in `<top (required)>'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/my
sql2.rb:31:in `require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x86-mingw32/lib/my
sql2.rb:31:in `<top (required)>'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runti
me.rb:76:in `require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runti
me.rb:76:in `block (2 levels) in require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runti
me.rb:72:in `each'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runti
me.rb:72:in `block in require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runti
me.rb:61:in `each'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler/runti
me.rb:61:in `require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.4/lib/bundler.rb:13
4:in `require'
    from C:/Users/Caroline/Sites/simple_cms/config/application.rb:7:in `<top
(required)>'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/command
s/commands_tasks.rb:78:in `require'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/command
s/commands_tasks.rb:78:in `block in server'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/command
s/commands_tasks.rb:75:in `tap'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/command
s/commands_tasks.rb:75:in `server'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/command
s/commands_tasks.rb:39:in `run_command!'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/command
s.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Can anyone advise me what has gone wrong here ? I'm working on Windows 7 Professional 32 OS.

Regards,

Caroline

Catess76
  • 23
  • 8
  • possible duplicate of [Ruby on Rails - cannot load such file -- mysql2/2.2/mysql2 (LoadError)](http://stackoverflow.com/questions/28925628/ruby-on-rails-cannot-load-such-file-mysql2-2-2-mysql2-loaderror) – j-dexx Jun 24 '15 at 13:01
  • I'll have a look although i had checked a lot of posts first before I wrote this. – Catess76 Jun 24 '15 at 13:04
  • you just need to install the mysql database – Yury Lebedev Jun 24 '15 at 13:11
  • Yes I had gone through that one but I'm still not able to start the server .... I have : ruby 2.2.2p95 (2015-04-13 revision 50295) [i386-mingw32] – Catess76 Jun 24 '15 at 13:11
  • I've done that - installed the mysql database I do believe - it was something that had to be done in tutorial previous to this part – Catess76 Jun 24 '15 at 13:12
  • @Catess76 can you post gemfile and did you run bundle install before starting server? – Mandeep Jun 25 '15 at 05:02
  • I am not sure what you mean my post gemfile (I'm new to ruby) , but I did run bundle install... at the moment I'm deleting ruby 2.2.2 and trying to install an earlier version..... it's all getting a bit of a mess :-( – Catess76 Jun 25 '15 at 09:33
  • Despite uninstalling ruby and re-installing an earlier version, and following all course instructions to the T, I am still getting an error and server hasn't started although error message looks like it did try to start this time at the top of the error. DL is deprecated, please use Fiddle => Booting WEBrick => Rails 4.0.0 application starting in development on http://0.0.0.0:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server Exiting – Catess76 Jun 25 '15 at 10:29
  • Then the same error under the new bit that looked promising for a moment :-( I can't continue with this tutorial with this problem occurring. – Catess76 Jun 25 '15 at 10:30
  • This also is under the start of the new error: C:/Users/Caroline/Sites/SIMPLE~1/config/environments/development.rb:1:in `': undefined method `configure' for # (NoMethodError) – Catess76 Jun 25 '15 at 10:35
  • something has changed ...... can anyone help please ? – Catess76 Jun 25 '15 at 10:35
  • @Catess76 you should tag people for replys :). Anyways by posting Gemfile, i meant can you edit your question and post your apps Gemfile in question :). For your last error checkout http://stackoverflow.com/questions/22977051/error-launching-rails-server-undefined-method-configure – Mandeep Jun 26 '15 at 17:22
  • @Mandeep I've started working on another tutorial and by using Ruby21 and this tutorial [link](https://www.youtube.com/watch?v=hy5x8aGKrrw) , with great difficulty and many problems previously I have now got the server working.... I now have another problem, where I add to browser address localhost/3000/users I now get this error: 'ExecJS::ProgramError in Users#index Showing C:/row/dev/hello_world/app/views/layouts/application.html.erb where line #6 raised: TypeError: Object doesn't support this property or method`_app_views_layouts_application_html_erb___823128240_54868956' – Catess76 Jun 30 '15 at 18:36
  • @Catess76 you don't have javascript runtime environment on your system. Checkout http://stackoverflow.com/questions/12520456/execjsruntimeerror-on-windows-trying-to-follow-rubytutorial – Mandeep Jul 01 '15 at 04:39
  • @Catess76 got it to work? Btw rails development on windows is pain, try switching to some linux – Mandeep Jul 01 '15 at 19:13
  • @Mandeep it sure is a pain ... I'll have a look at the link - still blimmin stuck here – Catess76 Jul 04 '15 at 14:32
  • I've just got past this error, answer found here http://stackoverflow.com/questions/28421547/rails-execjsprogramerror-in-pageshome - this comment In your /app/views/layouts/application.html.erb line 5 and 6, change the first parameter application to default. I met the same problem, too for my situation, I don't know why, but it only happen on Windows. The parameter application works on web server. I am absolutely amazed I found a solution after so long trying .... phew @Mandeep – Catess76 Jul 04 '15 at 15:03
  • @Catess76 that's because your server is linux and development machine is windows :P. Btw you should use application only in that line instead of using default, don't know how all the js assets are being setup in your app but my guess is you are skipping js assets by doing that. Why don't you install node js or some other javascript exec source – Mandeep Jul 04 '15 at 16:06
  • @mandeep I have installed node js. It seems to work so I'm happy with that, but always I am grateful to learn about what is happening in the background. Thankyou :-) – Catess76 Jul 04 '15 at 22:14
  • @Catess76 why don't you install Virtual machine and use linux for development? – Mandeep Jul 05 '15 at 16:29
  • @mandeep maybe I will in future but at the moment I need to crack on with Windows – Catess76 Jul 05 '15 at 20:24
  • @Catess76 if you'll continue with windows then i'm pretty sure that you are going to stuck somewhere pretty soon :p – Mandeep Jul 06 '15 at 17:34

0 Answers0