deployment - 以 username@servername : no implicit conversion of Array into String 身份执行时出现 Capistrano 异常

标签 deployment ruby-on-rails-5 capistrano3

我正在尝试将我的应用程序推送到我的服务器,我正在运行 Rails 5.2、Ruby 2.4.6 和 Capistrano 3。我过去的应用程序在服务器端 Rails 4.2 上运行。

当我尝试运行时 cap production deploy:check --trace并获得:

** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as username@servername: no implicit conversion of Array into String

Caused by:
TypeError: no implicit conversion of Array into String
/Users/username/.rbenv/versions/2.4.6/lib/ruby/2.4.0/pathname.rb:409:in `initialize'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/2.4.0/pathname.rb:409:in `new'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/2.4.0/pathname.rb:409:in `join'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/capistrano-3.11.0/lib/capistrano/dsl/paths.rb:81:in `block in join_paths'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/capistrano-3.11.0/lib/capistrano/dsl/paths.rb:81:in `map'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/capistrano-3.11.0/lib/capistrano/dsl/paths.rb:81:in `join_paths'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/capistrano-3.11.0/lib/capistrano/dsl/paths.rb:69:in `linked_files'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/capistrano-3.11.0/lib/capistrano/dsl/paths.rb:73:in `linked_file_dirs'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/capistrano-3.11.0/lib/capistrano/tasks/deploy.rake:81:in `block (4 levels) in <top (required)>'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:29:in `run'
/Users/username/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:check:make_linked_dirs

头文件:
require "capistrano/setup"

require "capistrano/deploy"
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/passenger'
require 'capistrano/rvm'

set :rvm_type, :user
set :rvm_ruby_version, '2.4.6'

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git


require "capistrano/rvm"
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"

Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

gem 文件:
group :development do
  #Capistrano deployment gems
  gem "capistrano", "~> 3.10", require: false
  gem "capistrano-rails", "~> 1.4", require: false
  gem 'capistrano-passenger', '~> 0.2.0'
  gem 'capistrano-rvm'

部署:
# config valid for current version and patch releases of Capistrano
lock "~> 3.11.0"

set :application, "app"
set :repo_url, "git@github.com:repo.git"

set :branch, "master"

set :deploy_to, "/var/www/appfolder"

append :linked_files, "config/database.yml"
append :linked_files, %w{config/master.key}

# Default value for linked_dirs is []
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads'

set :keep_releases, 5

set :migration_role, :app

生产.rb
server "servername", user: "deploy", roles: %w{app db web}

我环顾四周,但没有看到任何关于为什么我没有将 Array 隐式转换为 String 的信息。我把东西塞进了linked_dirs吗?如果我需要添加任何其他代码,请告诉我。我不知道从哪里看这一点。

最佳答案

如果您打印变量 cap -p production deploy:check我们你会看到变量 :linked_files => [["config/master.key"]]是数组列表而不是字符串列表。

你可以改变你的线路

append :linked_files, "config/master.key"

关于deployment - 以 username@servername : no implicit conversion of Array into String 身份执行时出现 Capistrano 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56631811/

相关文章:

mysql - CakePHP:如何将数据库架构更改无错误地部署到生产中

python - 部署 Python Azure 函数时中央目录损坏

docker - docker主机和节点有什么区别?

ruby-on-rails - 基于 where 谓词从 Rails API 中删除的 Curl 命令?

ruby-on-rails - rails c 在 rails 5 中不工作

ruby-on-rails - 使用 capistrano 部署时未找到错误命令 webpack

ruby-on-rails - 如何让 Capistrano 3 使用 RVM ruby​​?

ruby-on-rails - 向可大规模分发的网站添加安全功能是否安全?

ruby-on-rails - Rails系统规范是否仍然需要DatabaseCleaner?

ruby-on-rails - 未找到 Assets Rails 4 + Capistrano 3 + Puma