【问题标题】:Native Ruby module gives error "The specified module could not be found." which is not true本机 Ruby 模块给出错误“找不到指定的模块。”这不是真的
【发布时间】:2014-09-14 21:02:21
【问题描述】:

我刚刚使用命令为 Windows 安装了 Ruby gem "sqlite3"

>gem install sqlite3 --platform=ruby -- --with-sqlite3-include=c:/sqlite3/include --with-sqlite3-lib=c:/sqlite3/lib --with-sqlite3-dir=c:/sqlite3/bin

它看似完美地编译,但是当我尝试包含我得到的 gem 时:

irb(main):001:0> 需要“sqlite3”
LoadError:126:找不到指定的模块。 - C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3/sqlite3_native.so
        来自 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        来自 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        来自 C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3.rb:6:in `rescue in '
        来自 C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.9/lib/sqlite3.rb:2:in `'
        来自 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
        来自 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        来自 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        来自 (irb):1
        来自 C:/Ruby200/bin/irb:12:in `'

所以我检查了它为“sqlite3_native.so”提供的路径,你瞧,它就在那里!就像它应该是的那样。那么为什么鲁比要对我撒谎呢?如何找出 gem 不工作的真正原因?

我手动构建 gem 的原因是预构建的 gem 带有过时的 SQLite3 版本

【问题讨论】:

  • 你看到这个stackoverflow.com/questions/15480381/…了吗?尤其是第一个答案中的第 9 步
  • @UriAgassi:Rails 应用程序?我没有 Rails 应用程序。我只是想使用 irb 包含 sqlite3。另外,我没有安装多个 sqlite3-ruby 版本,只有 1.3.9。

标签: ruby sqlite


【解决方案1】:

基本上我在this answerHEADS UP部分找到了答案。

“sqlite3.dll”和“sqlite3.def”需要放在PATH的某个地方。我将它们复制到“C:\Ruby200\bin”中,现在我可以成功require "sqlite3"。不过我必须说,这是一个来自 Ruby 的非常无用的错误消息示例。

【讨论】:

  • 我的问题和你一模一样,只是把 .def 和 .dll 放在我系统 PATH 上的文件夹中并没有改变错误。
【解决方案2】:

在路径上有 sqlite3.dll 和 sqlite3.def 没有帮助。将它放在<install path>\Ruby25-x64\bin 中会有所帮助。

【讨论】:

    猜你喜欢
    • 2017-05-06
    • 2015-12-22
    • 2015-02-07
    • 2010-12-28
    • 2018-08-05
    • 2017-03-02
    • 2016-06-29
    • 2014-06-12
    • 1970-01-01
    相关资源
    最近更新 更多