4

初めて Rails 4.0 をインストールしてみました。Ruby 2.0 x64 を搭載した Windows 8。ラン:

gem install rails --version 4.0.0.rc1 --no-ri --no-rdoc

次に実行します:

rails new test_app
cd test_app
rails s

しかし、の Web ページでlocalhost:3000は次のエラーが報告されています。

データベース アダプタに 'sqlite3' を指定しましたが、gem がロードされていません。gem 'sqlite3'Gemfileに追加します。

それは私のGemfileにあります:

gem 'sqlite3'

何度か実行してみbundle installましたが、他のすべての宝石の中にリストされていません。

更新: sqlite3 gem を 2 つの異なる方法でインストールしようとしました。両方とも、DevKit の msys.bat ファイルから開くターミナルを使用します。以下の@szinesが言及している方法では、次のエラーが発生します。

$ gem install sqlite3 --platform=ruby -- --with-opt-dir=c:/sqlite-amalgamation-3071602
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-dir=c:/sqlite-amalgamation-3071602'
This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    c:/Ruby200-x64/bin/ruby.exe extconf.rb --with-opt-dir=c:/sqlite-amalgamation-3071602
checking for sqlite3.h... yes
checking for sqlite3_libversion_number()... -lsqlite3
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=c:/Ruby200-x64/bin/ruby
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/
        --enable-local
        --disable-local
        --with-sqlite3lib
        --without-sqlite3lib


Gem files will remain installed in c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7 for inspection.
Results logged to c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out

別の方法として、sqlite.org の autoconf パッケージを使用すると、sqlite3 gem をコンパイルしてインストールできます。ただし、Rails サーバーを開こうとすると、次のエラーが表示されます。

C:\Users\me\RubymineProjects\my_project>rails s
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in <top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
        from C:/Users/me/RubymineProjects/my_project/config/application.rb:7:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `block in <top (required)>'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
4

6 に答える 6