LoadError:无法加载此类文件 - tiny_tds / tiny_tds

时间:2016-06-20 15:27:13

标签: ruby-on-rails ruby redmine

首先让我说我不是Ruby开发者。我只是想在Windows x64上安装Redmine。我在这里找到了类似的问题,稍后我将链接。但由于我不是Ruby开发人员,我不理解答案,不能将它们应用到我的情况中。所以请在答案中稍微详细一点,以便我能完全理解我在做什么。

我进入Redmine Install中的第5步,产生以下错误:

C:\redmine\redmine-3.2.3>bundle exec rake generate_secret_token
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
rake aborted!
LoadError: cannot load such file -- tiny_tds/tiny_tds
C:/redmine/redmine-3.2.3/config/application.rb:5:in `<top (required)>'
C:/redmine/redmine-3.2.3/Rakefile:5:in `require'
C:/redmine/redmine-3.2.3/Rakefile:5:in `<top (required)>'
LoadError: cannot load such file -- tiny_tds/2.2/tiny_tds
C:/redmine/redmine-3.2.3/config/application.rb:5:in `<top (required)>'
C:/redmine/redmine-3.2.3/Rakefile:5:in `require'
C:/redmine/redmine-3.2.3/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

查看this answerthis answer,我看到看着Redmine的Gemfile和我的宝石列表应该提供一些关于问题的见解。

问题似乎是tiny_tds,而Gemfile中唯一提到的地方是:

when /sqlserver/
  gem "tiny_tds", "~> 0.6.2", :platforms => [:mri, :mingw, :x64_mingw]
  gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]

来自我的gem list

rake (11.2.2, default: 10.4.2)
tiny_tds (1.0.4, 0.6.2 x64-mingw32)

在我看来,我安装了raketiny_tds的多个版本,并选择了错误的版本。上面链接的答案之一似乎表明需要编辑Gemfile以选择正确的版本,而另一个似乎建议使用bundle exec来处理这个问题。

那么我需要在这做什么才能完成此安装?

3 个答案:

答案 0 :(得分:0)

我遇到了这个问题(对于webdev来说是全新的)但是在搜索之后,我通过运行以下命令让一切工作

gem install tiny_tds 

# Run these next commands within the tiny_tds directory.

# Now install the dependencies (Requires bundler)
bundle install 

# Now compile the gem. (Requires docker toolbox)
rake gem:windows

Here是tiny_tds自述文件的一部分链接,用于安装Windows。希望这会有所帮助。

答案 1 :(得分:0)

已经有很长一段时间但是可能有像我这样的人仍然需要一个适用于Windows Server 2012的解决方案。

我通过安装tiny_tds建议的@coderjoe找到了.gem git page的解决方案。

  1. google drive
  2. 下载gem
  3. --local安装,因为我的64位系统x86版本正常工作

    gem install --local .\tiny_tds-1.1.0-x86-mingw32.gem

    查看日志:

    PS C:\Users\mesut.gunes\Downloads> gem install --local .\tiny_tds-1.1.0-x64-mingw32.gem
    The system cannot find the path specified.
    Successfully installed tiny_tds-1.1.0-x64-mingw32
    Parsing documentation for tiny_tds-1.1.0-x64-mingw32
    Installing ri documentation for tiny_tds-1.1.0-x64-mingw32
    Done installing documentation for tiny_tds after 0 seconds
    1 gem installed
    PS C:\Users\mesut.gunes\Downloads> irb
    irb(main):001:0>
    irb(main):002:0* require "tiny_tds"
    LoadError: cannot load such file -- tiny_tds/tiny_tds
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:126:in `require'
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:126:in `require'
            from C:/Ruby23/lib/ruby/gems/2.3.0/gems/tiny_tds-1.2.0-x86-mingw32/lib/tiny_tds.rb:22:in `rescue in <top (required)>'
            from C:/Ruby23/lib/ruby/gems/2.3.0/gems/tiny_tds-1.2.0-x86-mingw32/lib/tiny_tds.rb:25:in `<top (required)>'
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135:in `require'
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:144:in `require'
            from (irb):2
            from C:/Ruby23/bin/irb.cmd:19:in `<main>'
    irb(main):003:0> require "tiny_tds"
    LoadError: cannot load such file -- tiny_tds
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135:in `require'
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
            from C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:144:in `require'
            from (irb):3
            from C:/Ruby23/bin/irb.cmd:19:in `<main>'
    irb(main):004:0> exit
    PS C:\Users\mesut.gunes\Downloads>
    PS C:\Users\mesut.gunes\Downloads> gem install --local .\tiny_tds-1.1.0-x86-mingw32.gem
    The system cannot find the path specified.
    Successfully installed tiny_tds-1.1.0-x86-mingw32
    Parsing documentation for tiny_tds-1.1.0-x86-mingw32
    Installing ri documentation for tiny_tds-1.1.0-x86-mingw32
    Done installing documentation for tiny_tds after 0 seconds
    1 gem installed
    PS C:\Users\mesut.gunes\Downloads> irb
    irb(main):001:0> require "tiny_tds"
    => true
    irb(main):002:0>
    irb(main):003:0* client = TinyTds::Client.new username: 'test', password: 'Paassword', host: 'test.local.db'
    => #<TinyTds::Client:0x23bfd88 @query_options={:as=>:hash, :symbolize_keys=>false, :cache_rows=>true, :timezone=>:local, :empty_sets=>true}>
    irb(main):004:0>
    irb(main):005:0* client.EXECUTE("SELECT TOP 1 ID from Order_Code_Order WHERE OrderOrderCode='634829'")
    

答案 2 :(得分:0)

此错误是由于Windows上的0.6.2版本的tiny_tds出现问题,而不是由于bundle无法解析正确的版本。您无需担心安装了多个版本的tiny_tds;对于正在执行的任何命令,bundle exec命令将读取Gemfile并加载每个gem的正确版本。

安装Redmine 3.3.3时,通过更新Redmine Gemfile以使用tiny_tds版本0.7.0,我能够克服此特定错误。如您所料,您必须编辑Redmine文件夹中的Gemfile。搜索“tiny_tds”并将版本号从0.6.2更新为0.7.0。

进行此更改后,您必须重新执行bundle install --without development test rmagick命令。这将安装tiny_tds版本0.7.0。然后,您应该能够无错误地执行bundle exec rake generate_secret_token

我看到你已经安装了0.6.2和1.0.4。我根本不熟悉tiny_tds,我不知道0.6.2和1.0.4之间是否有重大变化。我的印象是0.7.0是0.6.2之后的第一个工作版本,因此具有破坏更改风险最小的版本。我可以确认这是在Redmine 3.3.3.stable中使用SQL Server而没有错误。