2016-07-22 47 views
1

我試圖在Windows機器上開始Ruby on Rails開發,但是我無法獲取WEBrick以啓動默認的Rails應用程序。WEBrick無法啓動默認導軌應用程序:「未初始化的常量ActiveRecord :: ConnectionAdapters :: Column :: Format」

下面是從我試圖創建和啓動應用程序的輸出:

C:\Users\my_user>ruby -v 
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32] 

C:\Users\my_user\Desktop\wkspc>rails new sample_app 
[...] 
Bundle complete! 11 Gemfile dependencies, 57 gems now installed. 
Use `bundle show [gemname]` to see where a bundled gem is installed. 

C:\Users\my_user\Desktop\wkspc>cd sample_app 

C:\Users\my_user\Desktop\wkspc\sample_app>rails server 
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from require at bin/rails:4) 
Bundler::GemRequireError: There was an error while trying to load the gem 'activerecord-jdbcsqlite3-adapter'. 
Gem Load Error is: uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format 
Backtrace for gem load error is: 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:13:in `<module:TypeCast>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:7:in `<module:Jdbc>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:4:in `<module:ConnectionAdapters>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/type_cast.rb:3:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:1:in `singleton class' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:70:in `<class:singleton class>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:68:in `<module:JdbcColumn>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:12:in `<module:ConnectionAdapters>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:2:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/column.rb:1:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/adapter.rb:1:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/adapter.rb:1:in `<module:(root)>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc/adapter.rb:9:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc.rb:1:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc.rb:1:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc.rb:52:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc.rb:52:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc.rb:3:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc/jdbc.rb:3:in `block in (root)' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc.rb:1:in `each' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc.rb:1:in `block in (root)' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc.rb:9:in `each' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.20/lib/arjdbc.rb:9:in `(root)' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbcsqlite3-adapter-1.3.20/lib/activerecord-jdbcsqlite3-adapter.rb:1:in `(root)' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/activerecord-jdbcsqlite3-adapter-1.3.20/lib/activerecord-jdbcsqlite3-adapter.rb:2:in `<top>' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:1:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:1:in `block in (root)' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `tap' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `require' 
C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `<top>' 
bin/rails:4:in `require' 
bin/rails:4:in `<top>' 
Bundler Error Backtrace: 

    block in require at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:90 
       each at org/jruby/RubyArray.java:1593 
    block in require at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:81 
       each at org/jruby/RubyArray.java:1593 
      require at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler/runtime.rb:70 
      require at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/bundler-1.12.5/lib/bundler.rb:102 
      <top> at C:/Users/my_user/Desktop/wkspc/sample_app/config/application.rb:7 
      require at org/jruby/RubyKernel.java:944 
    block in (root) at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:1 
       tap at org/jruby/RubyKernel.java:1743 
      server at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:88 
      server at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85 
      <top> at C:/jruby-9.1.2.0/lib/ruby/gems/shared/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49 
      require at org/jruby/RubyKernel.java:944 
      <top> at bin/rails:4 

看來好像這個問題是從寶石的ActiveRecord-jdbcsqlite3適配器「的到來,以及錯誤指示 uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format

我跳過了一些重要的配置步驟嗎?謝謝你的幫助!

+0

一點也沒有」看起來你運行'rake db:create'來創建數據庫。 – covard

+0

謝謝,我認爲這可能是一個很好的開始:我試着運行'rake db:create',並且有趣的是,它輸出與上面相同的錯誤,就像我再次運行'rails server'一樣。 –

+0

有趣。你可能想看看[gorails](https://gorails.com/dashboard)來設置一切。他們有針對所有平臺的指南,即(OS X,Linux,Windows),我注意到你在windows上。所以這可能是一個很好的開始。這裏是[指南](https://gorails.com/setup/windows/10) – covard

回答

1

this issue,ActiveRecord的-JDBC適配器仍然有Rails中5兼容性問題存在於軌道-5可以使用這條線在你的Gemfile使用分支:

gem 'activerecord-jdbc-adapter', :git => "https://github.com/jruby/activerecord-jdbc-adapter.git", 
           :branch => "rails-5" 
+0

謝謝,這個問題看起來很有希望。可悲的是,加入到我的Gemfile產生'[致命]:讀取錯誤:無效參數' –

+1

明白了。問題在於我們試圖指定回購的方式。這裏是修復它:我用'gem'activerecord-jdbc-adapter',:git =>「https://github.com/jruby/activerecord-」替換了我的Gemfile中的'gem'activerecord -jdbcsqlite3-adapter''行。 jdbc-adapter.git「,:branch =>」rails-5「'。然後,我運行'bundle install'和'rails server',它現在正在運行。非常感謝! –

+0

'git_source(:github){| repo_name | 「https://github.com/#{repo_name}.git」}; gem'activerecord-jdbc-adapter','〜> 1.3.21',github:'jruby/activerecord-jdbc-adapter',分支:'rails-5'' – Barry

相關問題