Capistrano无法通过SSHKit :: Command :: Failed进行deploy:assets:precompile失败:rake退出状态:1

时间:2018-10-14 03:17:18

标签: ruby-on-rails ruby deployment server capistrano

感谢您对此进行检查。

我最近遇到了这个问题。对于解决问题的任何想法,我将不胜感激。

我应该注意,我是在私有服务器上部署Rails应用程序的新手。我只是碰巧要使用其中一个应用程序来开展业务,而现在我被困在这个位置。

这是问题所在:Capistrano没有超越 deploy:assets:precompile 的任务,并给出以下错误 SSHKit :: Command :: Failed:rake exit status:1 < / strong>

在下面查看日志示例

    ** Execute deploy:updated
                ** Invoke deploy:compile_assets (first_time)
                ** Invoke deploy:set_rails_env 
                ** Execute deploy:compile_assets
                ** Invoke deploy:assets:precompile (first_time)
                ** Execute deploy:assets:precompile
                00:22 deploy:assets:precompile
                      01 $HOME/.rbenv/bin/rbenv exec 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/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:29:in `block in parse'
                      01 /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:26:in `each'
                      01 /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:26:in `each_with_object'

            (...)

            #<Thread:0x00007fd8daf941c8@/home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
            Traceback (most recent call last):
                1: from /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
            /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@(SERVER IP): 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

            (...)

            /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:29:in `block in parse'
            /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:26:in `each'

    (...)

        /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
        /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'

        Caused by:
        SSHKit::Command::Failed: rake exit status: 1
        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

(...)    (See full trace by running task with --trace)
    ** Invoke deploy:failed (first_time)
    ** Execute deploy:failed


    ** DEPLOY FAILED

这太可怕了,因为它很大。我以为如果较小的话,我会设法修复它。

2 个答案:

答案 0 :(得分:1)

在读取机密时(堆栈跟踪指向Psych::SyntaxError,您会得到/home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:29

检查机密文件(config/secrets.yml)是否正确。 另外,请尝试首先在本地运行assets:precompile,以检查这是否只是服务器上的问题。

答案 1 :(得分:0)

我确实设法在那个精确的capistrano任务上对资产进行了预编译,现在它已经完成了。问题是我在/ parthumps / config上没有secrets.yml,而在/ parthumps / shared / config上只有一个。