在dlload中进行抢救':无法在运行上限中加载user32(Fiddle :: DLError)

时间:2017-08-03 23:53:37

标签: ruby ssh rubygems capistrano

我安装了Capistrano 2并面临着白色执行上限的问题 命令。操作系统是Windows 2012 R2。 所以,当我跑, 上限<<>>部署

显示的错误是

  

/usr/share/ruby/2.3.0/fiddle/import.rb:86:in在救援中   dlload':无法加载user32(Fiddle :: DLError)

from /usr/share/ruby/2.3.0/fiddle/import.rb:83:in `block in dlload'
    from /usr/share/ruby/2.3.0/fiddle/import.rb:74:in `collect'
    from /usr/share/ruby/2.3.0/fiddle/import.rb:74:in `dlload'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/pageant.rb:59:in
    `<module:Win>'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/pageant.rb:41:in
    `<module:Pageant>'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/pageant.rb:33:in
    `<module:Authentication>'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/pageant.rb:24:in
    `<module:SSH>'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/pageant.rb:24:in
    `<module:Net>'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/pageant.rb:24:in `<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/agent.rb:9:in
    `<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/key_manager.rb:4:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in`require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh/authentication/session.rb:4:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in`require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-4.0.1/lib/net/ssh.rb:12:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in`require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/net-ssh-gateway-2.0.0/lib/net/ssh/gateway.rb:2:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/capistrano-2.15.9/lib/capistrano/configuration/connections.rb:2:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in`require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in`require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/capistrano-2.15.9/lib/capistrano/configuration.rb:5:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in`require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/capistrano-2.15./lib/capistrano.rb:3:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/capistrano-2.15./lib/capistrano/cli.rb:1:in`<top (required)>'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /usr/local/share/ruby/site_ruby/rubygems/core_ex/kernel_require.rb:55:in
    `require'
    from /home/Administrator/.gem/ruby/2.3.0/gems/capistrano-2.15.9/bin/cap:3:in
    `<top (required)>'
    from /home/Administrator/bin/cap:23:in `load'
    from /home/Administrator/bin/cap:23:in `<main>'

My gem environment info is given below -

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.12
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-cygwin]
  - INSTALLATION DIRECTORY: /home/Administrator/.gem/ruby/2.3.0
  - USER INSTALLATION DIRECTORY: /home/Administrator/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /usr/bin/ruby.exe
  - EXECUTABLE DIRECTORY: /home/Administrator/bin
  - SPEC CACHE DIRECTORY: /home/Administrator/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-cygwin
  - GEM PATHS:
     - /home/Administrator/.gem/ruby/2.3.0
     - /usr/share/gems
     - /usr/local/share/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin

宝石清单是 -

*本地宝石*

建造者(3.2.2) 卡皮斯特拉诺(2.15.9) capistrano-ext(1.2.1) capistrano_rsync_with_remote_cache(2.4.0) did_you_mean(1.0.2) 高线(1.7.8) io-console(0.4.6) json(1.8.6) minitest(5.10.1) net-scp(1.2.1) net-sftp(2.1.2) net-ssh(4.0.1) net-ssh-gateway(2.0.0) 心理(2.2.4) 无轨部署(1.1.2) 耙子(11.3.0) rdoc(4.3.0)

请告知。

1 个答案:

答案 0 :(得分:0)

我知道这是一个古老的问题,但是在尝试找到解决问题的方法时,我偶然发现了这里。这与问题中显示的错误日志相同。至少在Windows下,这似乎是旧红宝石的普遍问题。

我正在运行Cygwin under Windows 7 x64, with RVM and Ruby 2.2.6,是的,我知道它已经老了。

在用RVM安装Ruby时,我遇到了类似的问题,但后来我暂时解决了,我认为这只是在制作红宝石时。但是现在我在做bundle exec cap some_env deploy时遇到了同样的问题,capistrano在使用net-ssh时,出现了与问题中相同的错误。

问题是Fiddle#dlopen没有尝试使用扩展名.dll。在当前使用Fiddle.dlopen("user32")的调用中导致错误的情况下,应该使用Fiddle.dlopen("user32.dll")进行尝试。

我在第ruby-2.2.6/lib/ruby/2.2.0/fiddle/import.rb行的第83行附近做了一个破解程序:

      begin
        Fiddle.dlopen(lib)
      rescue DLError
        raise(DLError, "can't load #{lib}")
      end

我将其更改为

      begin
        Fiddle.dlopen(lib)
      rescue DLError
        if lib.to_s !~ /\.dll/
          lib = "#{lib}.dll"
          retry
        end
        raise(DLError, "can't load #{lib}")
      end

它有效。