“193: %1 is not a valid Win32 application” bug with a new Rails Application

前端 未结 6 1916
北海茫月
北海茫月 2020-11-29 07:08

I have a new rails application which I have created under Windows 7 by going into a directory and typing \"rails newapp\". The creation went fine, and when I access the root

相关标签:
6条回答
  • 2020-11-29 07:25

    Here's the answer that worked for me. Turns out it was an issue of x64 vs. x32 issue and Rails 2.3.2.

    The answer I got from here (http://osdir.com/ml/RubyonRailsTalk/2009-06/msg01775.html):

    In case anyone else has the same problem after a lot of struggling on my Windows XP x64 machine, with MySQL 5.1.30 (x64) and Rails 2.3.2 installed, this above suggestiong helped me. Download libMySql.dll from here (http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/) and putting it in ruby\bin solved the problem.

    0 讨论(0)
  • 2020-11-29 07:26

    Having run into multiple issues setting up MySQL with Rails on Windows x64 my recommendations are:

    • Install the 32-bit version of MySQL, do not try to use the 64-bit version.
    • Install into a path with no spaces, do not accept a default like "C:\Program Files\MySQL\MySQL Server 5.5\"
    • Install the MySQL gem with an invocation similar to:
           gem install mysql -- --platform=ruby --with-mysql-dir="D:\Programs\MySQL\MySQL-Server-5.5" --with-libmysqllib="D:\Programs\MySQL\MySQL-Server-5.5\lib\"
    • Be sure to uninstall/reinstall the gem whenever you install a new version of MySQL.
    • Make sure D:\Programs\MySQL\MySQL-Server-5.5\lib is included in your path, as well as D:\Programs\MySQL\MySQL-Server-5.5\bin. Make sure other copies of libmysql.dll are not being picked up from elsewhere on your path or your ruby installation directories.

    This worked for me with mysql-5.5.15-win32, mysql-2.8.1-x86-mingw32 and Windows 7 x64.

      0 讨论(0)
    • 2020-11-29 07:31

      Copy the file libmysql.dll from your MySQL installation directory and paste it into your Ruby installation's bin directory. You may need to download a zip archive from http://dev.mysql.com/downloads/mysql/ if your MySQL installation directory doesn't already include the file libmysql.dll.

      0 讨论(0)
    • 2020-11-29 07:32

      This error occurs if you have a file with name "Program" in the root of your drive. Say for example you are trying to execute "C:\Program Files\SomeApp\Bin\SomeExe.Exe" it tries to execute "C:\Program" if it exists. In some situations a file with this name get created if you forget to quote "C:\Program Files..." with some commandline commands. This of course also applies for you D: drive, etc.

      This error often occurs if you try to start services, but may occur in other situations.

      Simply deleting the file C:\Program or D:\Program etc. solves the problem.

      0 讨论(0)
    • 2020-11-29 07:43

      Using Ruby (1.8.7) with MySQL(5.5) on Windows 7 and also getting error 193. Copying the libmySQL.dll to ruby /bin worked fine for me.

      C:\Work\redmine-2.4.1\config\database.yml content:
      
      # Default setup is given for MySQL with ruby1.9. If you're running Redmine
      # with MySQL and ruby1.8, replace the adapter name with `mysql`.
      # Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
      # Line indentation must be 2 spaces (no tabs).
      
      production:
        adapter: mysql
        database: redmine
        host: localhost
        username: root
        password: "pwd@123"
        encoding: utf8
      
      
      0 讨论(0)
    • 2020-11-29 07:44

      Solved by following the directions on this blog here: http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

      which involves using the non installer version of the MySQL Connector http://dev.mysql.com/downloads/connector/c/

      I could not get webrick to run on x64 Windows 7 system -- got the same error

      "193: %1 is not a valid Win32 application”

      If I just replaced the file libmysql.dll (as suggested in posts above), I got a different error.

      "Incorrect MySQL client library version!"

      My Path set like this: C:\Ruby187\bin;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Ruby187\lib\ruby\gems\1.8\gems\rails-3.1.1\bin

      (didn't need to change the path again)

      0 讨论(0)
    提交回复
    热议问题