我正在尝试使用net / sftp gem从Heroku的SFTP To Go下载文件,但我总是得到#的未定义方法'e ='。
曾经在线搜索,但找不到任何相关解决方案。这是我的代码:
task employer_email_import: :environment do
require 'net/sftp'
require 'uri'
sftptogo_url = ENV['SFTPTOGO_URL']
uri = URI.parse(sftptogo_url)
Net::SFTP.start(uri.host, uri.user, :password => uri.password) do |sftp|
sftp.download!("some_directory", "some_directory")
end
end
错误:
#
“ / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / net-ssh-3.2.0 / lib / net / ssh / buffer.rb:255:在read_keyblob'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/buffer.rb:239:in
read_key'“中,” / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / net-ssh-3.2.0 / lib / net / ssh /known_hosts.rb:145:在block (2 levels) in keys_for'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/known_hosts.rb:127:in
each_line'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2中。 0 / lib / net / ssh / known_hosts.rb:127:in block in keys_for'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/known_hosts.rb:125:in
open'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems /net-ssh-3.2.0/lib/net/ssh/known_hosts.rb:125:in keys_for'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/known_hosts.rb:55:in
块在search_in'“,”,“ / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / net-ssh-3.2.0 / lib / net / ssh / known_hosts.rb:55:in map'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/known_hosts.rb:55:in
search_in'“,” /home/romz/.rbenv/versions /2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/known_hosts.rb:49:在search_for'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:96:in
host_keys'“,” / home中/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/algorithms.rb:251:in {{1 }}初始化'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session .rb:86:in {{1} }初始化“”,“ / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / net-ssh-3.2.0 / lib / net / ssh.rb:232:在prepare_preferred_algorithms!'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/algorithms.rb:124:in
开始中“”,“ /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-sftp-2.1.2/lib/net/sftp .rb:31:in new'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:86:in
中的“”,“ / home / romz / Desktop / Romz / site / ROR / recoverysuite / lib / tasks / scheduler.rake:353:in {{1 }}在''',“ /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:248中进行阻止:在new'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in
中,“,” / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / rake-11.3.0 / lib / rake / task.rb :243:in start'", "/home/romz/Desktop/Romz/site/ROR/recoverysuite/lib/tasks/scheduler.rake:376:in
中的invoke_with_call_chain中的块'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in each'", "/home/romz/Desktop/Romz/site/ROR/recoverysuite/lib/tasks/scheduler.rake:353:in
invoke_with_call_chain'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:173:in {{ 1}} invoke_task'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:108:在block in execute'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:243:in
中每个“”,“ / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / rake-11.3.0 / lib / rake / ap plication.rb:108:在execute'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:187:in
run_with_threads'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib中/rake/application.rb:102:在mon_synchronize'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/task.rb:180:in
块中运行'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake- 11.3.0 / lib / rake / application.rb:178:in invoke'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:152:in
run'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems /rake-11.3.0/exe/rake:27:in block (2 levels) in top_level'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:108:in
load'“,” /home/romz/.rbenv/versions/2.4.0/bin/rake:23:in block in top_level'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:117:in
加载”,“ / home / romz / .rbenv / versions / 2.4.0 / lib / ruby / gems / 2.4.0 / gems / bundler-2.0.1 / lib / bundler / cli / exec.rb:74:in top_level'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:80:in
运行'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-2.0.1/lib/bundler/cli.rb: 463:在standard_exception_handling'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-11.3.0/lib/rake/application.rb:77:in
中运行'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-2.0.1/lib/bundler/vendor /thor/lib/thor/invocation.rb:126:in <top (required)>'", "/home/romz/.rbenv/versions/2.4.0/bin/rake:23:in
dispatch'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/ bundler-2.0.1 / lib / bundler / cli.rb:27:in <top (required)>'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in
start'“,” /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0 /gems/bundler-2.0.1/li b / bundler / cli.rb:18:在{“ {1}}中的'”,“ /home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler- 2.0.1 / lib / bundler / friendly_errors.rb:124:in kernel_load'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:28:in
'“,” /home/romz/.rbenv/versions/2.4.0/bin/bundle:23:in exec'", "/home/romz/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in
'“
RUBY_VERSION =>“ 2.4.0”
OpenSSL :: OPENSSL_VERSION =>“ OpenSSL 1.1.0g,2017年11月2日”
OpenSSL :: VERSION =>“ 2.0.2”
rails --version => Rails 5.0.7.1
答案 0 :(得分:0)
使用:
gem 'net-sftp'
gem 'net-ssh', '~> 5.1.0'
gem 'openssl', '~> 2.0.0.beta.1'
这将解决您的问题。