简体   繁体   中英

Issue to start the Rails built-in server

When I hit the command to star the Rails server I always get this message:

C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:
2:in `require': 193: %1 is not a valid Win32 application.   - C:/Ruby/lib/ruby/g
ems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysq
l2/mysql2.rb:2:in `<top (required)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysq
l2.rb:9:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysq
l2.rb:9:in `<top (required)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:68:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:68:in `block (2 levels) in require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:66:in `each'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:66:in `block in require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:55:in `each'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:55:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:128:i
n `require'
        from D:/Ruby/Rails/simple_cms/config/application.rb:7:in `<top (required
)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:53:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:53:in `block in <top (required)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:50:in `tap'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

I'm using the mysql2 gem and I'm trying to use mysql from WampServer.

Thanks for your help.

I guess you are looking for the following:

Ruby mysql2 Error

After installing the gem do the following:

Install the mysql2 gem with paths pointing to where you installed the MySQL Connector library and includes.

NOTE: Make sure you do have the single quote (') as shown below:

gem install mysql2 -- '--with-mysql-lib="C:...\\MySQL Connector C 6.0.2\\lib\\opt" --with-mysql-include="C:...\\MySQL Connector C 6.0.2\\include"'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM