rails服务器没有启动

时间:2014-08-08 11:52:43

标签: ruby-on-rails-4 windows-8.1 mysql2

它显示了一些错误,如

C:\Users\Vishnu\Sites\simple_cms>rails s

 E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2.rb:8:in
`require': 126: The specified module could not be found.   - E:/installations/Ru
by/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.16/mysql2/mysql2.
so (LoadError)
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/my
sql2.rb:8:in `<top (required)>'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler/runtime.rb:76:in `require'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler/runtime.rb:76:in `block (2 levels) in require'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler/runtime.rb:72:in `each'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler/runtime.rb:72:in `block in require'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler/runtime.rb:61:in `each'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler/runtime.rb:61:in `require'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/bundler-1.6.5/lib/bu
ndler.rb:132:in `require'
        from C:/Users/Vishnu/Sites/simple_cms/config/application.rb:7:in `<top (
required)>'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/r
ails/commands/commands_tasks.rb:79:in `require'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/r
ails/commands/commands_tasks.rb:79:in `block in server'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/r
ails/commands/commands_tasks.rb:76:in `tap'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/r
ails/commands/commands_tasks.rb:76:in `server'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/r
ails/commands/commands_tasks.rb:40:in `run_command!'
        from E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/r
ails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

2 个答案:

答案 0 :(得分:0)

要么你缺少Gemfile中的mysql2 gem。或者宝石没有编译。尝试:

gem install mysql2

并运行:

bundle

在启动服务器之前,确保一切都已结束。

答案 1 :(得分:0)

我遇到了一些问题,并为遇到此问题的任何人编写了一步一步的说明:

下载: (1)https://structure-svm-map.googlecode.com/files/svm-map-win.zip (2)http://sourceforge.net/projects/mingw/files/Installer/

第0步。 在命令提示符中输入命令卸载mysql2: gem uninstall mysql2

第1步。 将gendef.exe从svm-map(1)复制到MySql服务器目录,并在命令行中运行以下命令: gendef.exe libmysql.dll

第2步。 安装MinGW(2)并安装基本存储库 记住MinGW的安装位置 添加&#34; E:\ MinGW \ bin&#34; (根据应用程序的安装位置而改变)到PATH(环境变量)

第3步。 打开命令行的新实例并导航到MySql Server目录(我的E:\ Program Files \ MySQL \ MySQL Server 5.6) 运行以下命令行: dlltool -v --dllname libmysql.dll --def libmysql.def --output-lib libmysql.lib

第4步。 使用rubygems在命令行中使用以下选项安装mysql2(根据MySQL服务器的位置进行更改): gem install mysql2 --no-rdoc --no-ri - &#39; - withmysql-dir =&#34; E:\ Program Files \ MySQL \ MySQL Server 5.6 \ bin&#34; --with-mysql-lib =&#34; E:\ Program Files \ MySQL \ MySQL Server 5.6 \ lib&#34; --with-mysql-include =&#34; E:\ Program Files \ MySQL \ MySQL Server 5.6 \ include&#34;&#39;

第5步。 将libmysql.dll从MySQL服务器目录复制到&#34; E:\ Ruby200-x64 \ bin&#34; (根据应用程序的安装位置而变化)

第6步。 试试&#34; rails server&#34;在命令行中确保安装是否正确完成

相关问题