NoMethodError: undefined method `start_with?'

NoMethodError: undefined method `start_with?'

今天(我不知道为什么!!!!)我无法使用 capistrano 部署我的项目。

当我启动这个任务时

namespace :deploy do

  # Theme path
  set :theme_path, Pathname.new('web/app/themes').join(fetch(:theme_name))

  # Local Paths
  set :local_theme_path, Pathname.new(File.dirname(__FILE__)).join('../').join(fetch(:theme_path))
  set :local_dist_path, fetch(:local_theme_path).join('dist')

  task :compile do
    run_locally do
      within fetch(:local_theme_path) do
        execute "git checkout #{fetch(:branch)}"
        execute :gulp, '--production'
      end
    end
  end

  task :copy do
    on roles(:web) do

      # Remote Paths (Lazy-load until actual deploy)
      set :remote_dist_path, -> { release_path.join(fetch(:theme_path)).join('dist') }

      info " Your local distribution path: #{fetch(:local_dist_path)} "
      info " Boom!!! Your remote distribution path: #{fetch(:remote_dist_path)} "
      info " Uploading files to remote "
      upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path), recursive: true
    end
  end

  task assets: %w(compile copy)
end

Capistrano 打印这个错误

(Backtrace restricted to imported tasks)

cap aborted!

SSHKit::Runner::ExecuteError: Exception while executing as ec2->user@*********: undefined method `start_with?' for #Pathname:0x0000*fc***a****

Caused by:

NoMethodError: undefined method `start_with?' for #Pathname:0x0000*fc***a****

我尝试了所有:卸载节点,ruby,等等...没有任何改变。 有人可以帮助我吗?

谢谢

upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path), recursive: true

应该是

upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path).to_s, recursive: true

(在两个 Pathname 上调用 to_s。)