Rails Rails 启动报错的原因?

CharlesZCB · 2022年11月11日 · 最后由 huacnlee 回复于 2022年11月16日 · 229 次阅读

rails s 启动出现报错如下:这是什么问题??

ruby 版本 ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x64-mingw32]

warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
Traceback (most recent call last):
        23: from bin/rails:9:in `<main>'
        22: from bin/rails:9:in `require'
        21: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
        20: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke'
        19: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform'
        18: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        17: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        16: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        15: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform'
        14: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `tap'
        13: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:133:in `block in perform'
        12: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:133:in `require'
        11: from F:/develop/project/VS/jiankong/stea/config/application.rb:5:in `<top (required)>'
        10: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler.rb:114:in `require'
         9: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:65:in `require'
         8: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:65:in `each'
         7: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:76:in `block in require'
         6: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:76:in `each'
         5: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
         4: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:81:in `require'
         3: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mysql2-0.4.10-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
         2: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mysql2-0.4.10-x64-mingw32/lib/mysql2.rb:31:in `require'
         1: from F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mysql2-0.4.10-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
F:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/mysql2-0.4.10-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.7/mysql2 (LoadError)

安装一下 mysql-devel 依赖试试

cannot load such file -- mysql2/2.7/mysql2
需要 登录 后方可回复, 如果你还没有账号请 注册新账号