我已经按照github上的所有步骤和Ruby on rails安装的官方文档进行了操作。 我已经为sqlite3安装了gem。 另外,我已将sqlite的dll和def文件以及.exe文件复制到Ruby / bin 然后我创建了一个名为myapp的示例应用程序,并尝试通过命令“rails server”启动服务器
出现以下错误:
F:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7-x86-mingw32/lib/sqlite3.rb:6:i
n `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7-x86-mingw32/lib/s
qlite3.rb:6:in `rescue in <top (required)>'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7-x86-mingw32/lib/s
qlite3.rb:2:in `<top (required)>'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler/runti
me.rb:72:in `require'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler/runti
me.rb:72:in `block (2 levels) in require'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler/runti
me.rb:70:in `each'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler/runti
me.rb:70:in `block in require'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler/runti
me.rb:59:in `each'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler/runti
me.rb:59:in `require'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.4/lib/bundler.rb:13
2:in `require'
from F:/myapp/config/application.rb:7:in `<top (required)>'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/comma
nds.rb:24:in `require'
from F:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.2.13/lib/rails/comma
nds.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
这是“捆绑列表”命令的输出:
F:\myapp>bundle list
Gems included by the bund
* actionmailer (3.2.13)
* actionpack (3.2.13)
* activemodel (3.2.13)
* activerecord (3.2.13)
* activeresource (3.2.1
* activesupport (3.2.13
* arel (3.0.2)
* builder (3.0.4)
* bundler (1.3.4)
* coffee-rails (3.2.2)
* coffee-script (2.2.0)
* coffee-script-source
* erubis (2.7.0)
* execjs (1.4.0)
* hike (1.2.1)
* i18n (0.6.1)
* journey (1.0.4)
* jquery-rails (2.2.1)
* json (1.7.7)
* mail (2.5.3)
* mime-types (1.22)
* multi_json (1.7.2)
* polyglot (0.3.3)
* rack (1.4.5)
* rack-cache (1.2)
* rack-ssl (1.3.3)
* rack-test (0.6.2)
* rails (3.2.13)
* railties (3.2.13)
* rake (10.0.4)
* rdoc (3.12.2)
* sass (3.2.7)
* sass-rails (3.2.6)
* sprockets (2.2.2)
* sqlite3 (1.3.7)
* thor (0.18.1)
* tilt (1.3.6)
* treetop (1.4.12)
* tzinfo (0.3.37)
* uglifier (1.3.0)
请帮助我......我非常想在RoR中创建webapps,但我遇到了这些错误。 提前谢谢。
答案 0 :(得分:0)
将所需的可执行文件和dll从http://www.sqlite.org/download.html提取下载到你的ruby的bin(f:\ Ruby200 \ bin)
如果检查sqlite3的源代码:
# support multiple ruby version (fat binaries under windows)
begin
RUBY_VERSION =~ /(\d+\.\d+)/
require "sqlite3/#{$1}/sqlite3_native"
rescue LoadError
require 'sqlite3/sqlite3_native'
end
你的应用程序在 require'sqlite3 / sqlite3_native'中断,你可以执行irb并尝试加载该文件,它应该失败,修复它,你的应用程序应该运行没有任何问题。
确保在%PATH%上包含ruby二进制文件的路径,因此当您执行 require'sqlite3 / sqlite3_native'时,它实际上有一个指向该文件的有效路径。
您也可以尝试添加boot.rb文件:
$LOAD_PATH.unshift('F:/Ruby200/bin')
所以应用程序,当您需要具有相对路径 sqlite3 / sqlite3_native 的文件时,它实际上可以找到该文件。
一旦你能够加载该文件,它应该工作或利用分段错误(其窗口:P)