0

I setup a new rail application in Netbeans 7.1. Without writing any code, I wanted to see if it just runs but

When clicking run I get errors:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': 126: The specified module could not be found.   - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `block in require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
    from C:/_PROJECTS/active/Callisto2.0/config/application.rb:7:in `<top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I've installed a few gems it was complaining about through netbeans gem manager but I got stuck at mysql2. Even though I installed mysql and mysql2 gems, it still won't find it.

With little research, it seems i have to do a bundle install, for WEBrick to run/ check dependencies or whatever. Netbeans project has a Bundler context menu with options for check, init, install, show etc.

None of those produce any output in the Output: Bundler window. The Bundler process starts in netbeans processes but then quits after a second. No errors, info or anything.

What do I need to do to get this working. This is a blank Ruby/Rails Application through Netbeans 7.1.

EDIT 1: The error in file: C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2 contains the following lines:

RUBY_VERSION =~ /(\d+.\d+)/
require "mysql2/#{$1}/mysql2"

Nothing Special. I tried changing that to mysql, or just "mysql2", it doesn't work. Errors that client is not initialized when I comment the whole line.

4

2 回答 2

1

Netbeans 停止支持 Rails。看 :

Ruby 在 Netbeans 7 中掉线了,如何在 Netbeans7 中使用它?

和:

http://noteslog.com/post/netbeans-6-9-1-ruby-1-9-2-rails-3-0-0-mysql-gem-2-8-1/

于 2012-06-19T16:33:12.960 回答
0

您是否收到您的用户不允许安装 gems 的消息?

然后你应该在你的 Rails 应用程序根文件夹中尝试以下命令

bundle install --path vendor/bundle

确保在运行上一个命令之前database.ymlconfig文件夹中配置好,或者在创建文件后再次运行它。

于 2014-10-07T13:33:10.387 回答