Ruby Rails - Capistrano 部署错误
Ruby on Rails - Capistrano deploy error
我正在尝试完成本教程:https://gorails.com/deploy/ubuntu/16.04#capistrano
已完成教程,但在 运行 时出现错误:cap production deploy
为此工作了好几个小时。请帮忙!
这是我的错误:
00:30 deploy:assets:precompile
01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
01 rake aborted!
01 Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:27:in `block in parse'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:24:in `each'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:24:in `each_with_object'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:24:in `parse'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:391:in `secrets'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/devise-4.4.1/lib/devise/rails.rb:38:in `block in <class:Engine>'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
01 /home/deploy/motor-town/releases/20180209012320/config/environment.rb:5:in `<top (required)>'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in def…
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:75:in `load'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:75:in `kernel_load'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:28:in `run'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli.rb:424:in `exec'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli.rb:27:in `dispatch'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli.rb:18:in `start'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/exe/bundle:30:in `block in <top (required)>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/exe/bundle:22:in `<top (required)>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/bundle:23:in `load'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/bundle:23:in `<main>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'
01 Tasks: TOP => environment
01 (See full trace by running task with --trace)
#<Thread:0x00007fc6489acd40@/Users/German/.rvm/gems/ruby2.5.0@motor_town/gems/sshkit-1.16.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /Users/German/.rvm/gems/ruby-2.5.0@motor_town/gems/sshkit1.16.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/German/.rvm/gems/ruby-2.5.0@motor_town/gems/sshkit1.16.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@159.203.172.69: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: Nothing written
rake stderr: rake aborted!
Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
我认为问题与数据库有关,因为它在谈论列,但我又不确定。
这是我的 gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use Postgres as the database
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Bootstrap 4
gem 'bootstrap', '~> 4.0.0.beta2.1'
# Bootstrap requires jquery
gem 'jquery-rails'
# Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
gem 'simple_form'
# Send e-mail straight from forms in Rails with I18n, validations, attachments and request information
gem 'mail_form'
# ReCaptcha helpers for ruby apps
gem 'recaptcha', require: 'recaptcha/rails'
# Flexible authentication solution for Rails with Warden.
gem 'devise'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
# Preview mail in the browser instead of sending.
gem "letter_opener"
# Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.
gem 'capistrano', '~> 3.10', '>= 3.10.1'
# Rails specific Capistrano tasks
gem 'capistrano-rails', '~> 1.3', '>= 1.3.1'
# Passenger support for Capistrano 3.x
gem 'capistrano-passenger', '~> 0.2.0'
# RVM integration for Capistrano
gem 'capistrano-rvm'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
在尝试解决错误两天后,我回去重做了教程。
这是服务器配置文件之一的缩进问题!
我正在尝试完成本教程:https://gorails.com/deploy/ubuntu/16.04#capistrano
已完成教程,但在 运行 时出现错误:cap production deploy
为此工作了好几个小时。请帮忙!
这是我的错误:
00:30 deploy:assets:precompile
01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
01 rake aborted!
01 Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:27:in `block in parse'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:24:in `each'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:24:in `each_with_object'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/secrets.rb:24:in `parse'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:391:in `secrets'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/devise-4.4.1/lib/devise/rails.rb:38:in `block in <class:Engine>'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
01 /home/deploy/motor-town/releases/20180209012320/config/environment.rb:5:in `<top (required)>'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/application.rb:445:in `block in run_tasks_blocks'
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in def…
01 /home/deploy/motor-town/shared/bundle/ruby/2.5.0/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:75:in `load'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:75:in `kernel_load'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli/exec.rb:28:in `run'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli.rb:424:in `exec'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli.rb:27:in `dispatch'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/cli.rb:18:in `start'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/exe/bundle:30:in `block in <top (required)>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
01 /home/deploy/.rvm/gems/ruby-2.5.0/gems/bundler-1.16.1/exe/bundle:22:in `<top (required)>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/bundle:23:in `load'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/bundle:23:in `<main>'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
01 /home/deploy/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'
01 Tasks: TOP => environment
01 (See full trace by running task with --trace)
#<Thread:0x00007fc6489acd40@/Users/German/.rvm/gems/ruby2.5.0@motor_town/gems/sshkit-1.16.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /Users/German/.rvm/gems/ruby-2.5.0@motor_town/gems/sshkit1.16.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/German/.rvm/gems/ruby-2.5.0@motor_town/gems/sshkit1.16.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@159.203.172.69: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: Nothing written
rake stderr: rake aborted!
Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
我认为问题与数据库有关,因为它在谈论列,但我又不确定。
这是我的 gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use Postgres as the database
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Bootstrap 4
gem 'bootstrap', '~> 4.0.0.beta2.1'
# Bootstrap requires jquery
gem 'jquery-rails'
# Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
gem 'simple_form'
# Send e-mail straight from forms in Rails with I18n, validations, attachments and request information
gem 'mail_form'
# ReCaptcha helpers for ruby apps
gem 'recaptcha', require: 'recaptcha/rails'
# Flexible authentication solution for Rails with Warden.
gem 'devise'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
# Preview mail in the browser instead of sending.
gem "letter_opener"
# Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.
gem 'capistrano', '~> 3.10', '>= 3.10.1'
# Rails specific Capistrano tasks
gem 'capistrano-rails', '~> 1.3', '>= 1.3.1'
# Passenger support for Capistrano 3.x
gem 'capistrano-passenger', '~> 0.2.0'
# RVM integration for Capistrano
gem 'capistrano-rvm'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
在尝试解决错误两天后,我回去重做了教程。 这是服务器配置文件之一的缩进问题!