Kormi Web Solutions
Kormi Web Solutions

Reputation: 563

NoMethodError: undefined method `start_with?'

Today (I don't know why!!!!) I cannot deploy my project with capistrano.

When I launch this task

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 print this error

(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****

I try all: uninstall node, ruby, etc... ma nothing change. Someone can help me?

Thanks

Upvotes: 1

Views: 2269

Answers (1)

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 120990

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

should be

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

(call to_s on both Pathnames.)

Upvotes: 3

Related Questions