1

New to programming, ruby, rails, sql ect. Following along with video tutorials but ran into this error. Any help appreciated.

C:\sites\simple_cms>rails s
c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `requir
e': 126: The specified module could not be found.   - c:/ruby200-x64/lib/ruby/ge
ms/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so (LoadError)

        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb
:8:in `<top (required)>'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler/runtime.rb:76:in `require'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler/runtime.rb:76:in `block (2 levels) in require'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler/runtime.rb:72:in `each'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler/runtime.rb:72:in `block in require'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler/runtime.rb:61:in `each'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler/runtime.rb:61:in `require'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun
dler.rb:132:in `require'
        from C:/sites/simple_cms/config/application.rb:7:in `<top (required)>'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:74:in `require'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:74:in `block in <top (required)>'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:71:in `tap'
        from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/co
mmands.rb:71:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

C:\sites\simple_cms>
Uri Agassi
  • 36,848
  • 14
  • 76
  • 93
Jarg
  • 33
  • 4
  • try `bundle install` in `c:\sites\simple_cms` first then try again. Let me know if this works – Abdo Feb 08 '14 at 13:50
  • Thanks. Tried that but now got this error: c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `requir e': 193: %1 is not a valid Win32 application. - c:/ruby200-x64/lib/ruby/gems/2 .0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/mysql2/mysql2.so (LoadError) from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb :8:in `' from c:/ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.0.pre.2/lib/bun dler/runtime.rb:76:in `require' ..... – Jarg Feb 09 '14 at 06:30
  • The mysql2 gem needs some TLC to work under windows (at least, it was a pain when I tried). Apparently [this person](http://stackoverflow.com/a/19023107/877472) managed to solve it. Perhaps it may help you too. – Paul Richter Feb 11 '14 at 00:40

1 Answers1

0

We need to start from scratch here:

  1. Install Ruby with the Windows installer from http://rubyinstaller.org/downloads/
  2. Install bundler: gem install bundler
  3. For mysql on Windows, I think you need the devkit. Get the one that matches your os from http://rubyinstaller.org/downloads/
  4. Make sure you have mysql installed on your PC.
  5. Make sure the mysql2 gem installs correctly. if gem install mysql2 does not install correctly, you might need something like: gem install mysql2 -- --with-mysql-dir="C:\mysql\bin" ; change c:\mysql\bin to the location where you install mysql in step 4
  6. Install rails: gem install rails
  7. Go to your directory c:\sites\simple_cms and type: bundle install
  8. Now attempt to start your server: rails s

Rails development on Windows has made great improvements but if you really want to stay up to date and avoid some weird issues in the future (especially with gem support), I suggest you use Ubuntu for example. If you don't have another computer or do not wish to do a dual boot, you can install VirtualBox for free (https://www.virtualbox.org/wiki/Downloads) and have Ubuntu run on it.

Abdo
  • 13,549
  • 10
  • 79
  • 98
  • thanks for the help. Regarding starting from scratch. Do I need to uninstall everything first? Secondly, how do I know what versions I need ie. 32 bit or 64? I know im running 64 bit os but and I'm pretty sure my CPU is 64 bit enabled but when I look at system properties it only says 64 bit OS and doesn't mention my CPU. Does that indicate that it is not running 64 bit and may this have something to do with the errors? I think Im running 64 bit versions of all the ruby and sql software. Would it be easier to just run everything 32 bit? – Jarg Feb 09 '14 at 21:56
  • If you are running a 64 bit OS, you're good to go with the 64 bit installation. I don't think you need to uninstall anything. The installer should take care of that. Feel free to circulate back if you still have issues =) – Abdo Feb 09 '14 at 23:38
  • Thanks, I just installed virtual box and got ubuntu running on it. How do I do this on ubuntu now? I don't know where to begin really lol. Like do I have to download everything over, how do i access the comand prompt. and the commands on ubuntu are different no? – Jarg Feb 10 '14 at 09:18
  • You want to look for "Terminal", which is the console. Don't install Ruby with apt-get but rather with rvm (http://rvm.io) ... There will be a steep learning curve but after a little while, you'll be proud of yourself :-) (I used Windows for development myself at first and made the switch) – Abdo Feb 10 '14 at 11:48
  • now i did get rails installed on ubuntu but when i go to launch rails server im getting : jarg@jarg-VirtualBox:~/code/ruby/webapp$ rails s The program 'rails' can be found in the following packages: * rails * ruby-railties-3.2 Try: sudo apt-get install – Jarg Feb 11 '14 at 02:06
  • before it ran, but said some javascript missing something rather, and now wont run when i do rails s again says whats in my previous post. – Jarg Feb 11 '14 at 02:13
  • there's a line containing: `therubyracer` in your `Gemfile`, uncomment it and do: `bundle install` ... this error line you're seeing is telling you that you don't have a javascript engine running and it is needed.. – Abdo Feb 11 '14 at 11:54