Ruby on rails服务器不会启动

时间:2014-07-11 03:09:12

标签: ruby-on-rails ruby windows

我正在尝试在轨道上启动服务器,但它无法正常运行,为什么会出现这种情况?我没有编辑proyect,这是我第一次尝试启动它。我已经重新安装了宝石并使用了一些不同的选项安装捆绑,但都无济于事。我正在使用Windows。

C:\Users\Julián\Documents\Sites\simple_cms>rails server
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/comman
ds_tasks.rb:79:in `require': cannot load such file -- C:/Users/Julián/Documents/Sites/simple_cms/config/application (LoadError)
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

更新: 我在位于另一个文件夹上的新项目上运行相同的命令,没有任何奇怪的字符(例如“á”),也没有成功。这是新的错误。

C:\Users\Public\Sites\simple_cms>rails server
C:/Ruby200-x64/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.   - C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.16/mysql2/mysql2.so (LoadError)

    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `<top (required)>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:76:in `require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:72:in `each'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:72:in `block in require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:61:in `each'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler/runtime.rb:61:in `require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.6.3/lib/bundler.rb:132:in `require'        from C:/Users/Public/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:79:in `require'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

3 个答案:

答案 0 :(得分:0)

看起来command_tasks.rb无法找到您的应用程序文件。这可能是因为路径名称。 C:/Users/Julián/Documents/Sites/simple_cms/config/application Julián

似乎误认了您的名字Julián

答案 1 :(得分:0)

捆绑安装

可能是错的,但肯定你缺少mysql2 gem,或者Rails需要加载你的应用程序的mysql个文件。

如果您在系统上执行了bundle install,我们会确认这一点 - 我猜测mysql gem会失败


MYSQL Gem

考虑到你在Windows上,你可能没有安装MYSQL2 gem - 标准问题,我们编写了关于here的教程:

  
      
  1. 在您的系统上安装任何MYSQL C-Connector Header files
  2.   
  3. 使用相关参数
  4. 安装mysql2 gem   
  5. 将libmysql.dll文件复制到ruby/bin目录
  6.   

C-Connector头文件对Windows至关重要,因为它们允许您的系统“读取”#34; MYSQL命令/请求。这些都没有默认安装,所以你必须自己安装它们(它只是为了安装gem,如果你愿意,你可以把它们除掉):

http://dev.mysql.com/downloads/connector/c/

安装此文件,然后您可以使用以下安装命令:

gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector-path"'

应该在您的系统上安装gem,然后您可以通过从您的mysql文件传输libmysql.dll来完成该操作。 bin目录的ruby/bin目录:

enter image description here

答案 2 :(得分:-1)

可能是,您应该尝试使用Linux(Ubuntu)的虚拟机。 我第一次开始使用Windows,但是操作宝石和环境非常困难。