Ruby on rails Rails 4、Capistrano 3在bundle exec rake assets:precompile期间失败,并返回rake stdout:Nothing

Ruby on rails Rails 4、Capistrano 3在bundle exec rake assets:precompile期间失败,并返回rake stdout:Nothing,ruby-on-rails,ruby-on-rails-4,capistrano3,rvm-capistrano,sshkit,Ruby On Rails,Ruby On Rails 4,Capistrano3,Rvm Capistrano,Sshkit,在rake资源期间使用Capistrano部署失败:预编译: /usr/local/rvm/bin/rvm ruby-2.0.0-p353 do bundle exec rake assets:precompile 提示将响应此错误: INFO [b438501f] Running /usr/local/rvm/bin/rvm ruby-2.0.0-p353 do bundle exec rake assets:precompile on 123.123.123.123 cap aborte

在rake资源期间使用Capistrano部署失败:预编译:

/usr/local/rvm/bin/rvm ruby-2.0.0-p353 do bundle exec rake assets:precompile
提示将响应此错误:

INFO [b438501f] Running /usr/local/rvm/bin/rvm ruby-2.0.0-p353 do bundle exec rake assets:precompile on 123.123.123.123

cap aborted!
rake stdout: Nothing written
rake stderr: Nothing written
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/command.rb:94:in `exit_status='
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:59:in `block (6 levels) in <top (required)>'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/abstract.rb:89:in `with'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:58:in `block (5 levels) in <top (required)>'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/abstract.rb:81:in `within'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/capistrano-rails-1.1.1/lib/capistrano/tasks/assets.rake:57:in `block (4 levels) in <top (required)>'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/osiris/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: rake stdout: Nothing written
rake stderr: Nothing written
>
有关此问题的更多详细信息,请参见以下要点: 我注意到rake任务中没有提到环境,尽管我在production.rb中提到了它。它可以帮助用RAILS\u ENV=production覆盖命令的前缀

我试图用以下内容覆盖任务:

namespace :deploy do

  namespace :assets do
    task :precompile do
      on roles(fetch(:assets_roles)) do
        within release_path do
          with rails_env: fetch(:rails_env) do
            execute :rake, "assets:precompile RAILS_ENV=production"
          end
        end
      end
    end
  end
end

但它没有覆盖它。

我在DigitalOcean上的VPN中处理了相同的问题,我必须创建交换内存。我的VPS正在终止资产预编译过程

在创建交换内存之前,您可以检查服务器是否正在使用某些交换内存。我的服务器不是

试试这个:

  • 创建1GB交换内存
    
    sudo dd if=/dev/zero of=/usr/mem.swap bs=1M count=512
    

  • 使用在第一步中创建的交换内存
    
    sudo mkswap/usr/mem.swap
    sudo swapon/usr/mem.swap
    


在您的本地框中尝试预编译资产,您的sass或coffee/js文件中可能有错误您使用哪个gem与Capistrano一起管理rvm?如果您使用的是
capistrano rvm
,我认为将其更改为
rvm1-capistrano3
应该会有所帮助。我必须将VPS上的ram增加到1G才能编译资产。值得一试吗<代码>使用rails_env::production do这很有帮助,我今天看到了这个答案,你能解释一下原因吗?嗨!某些VPN主机未启用交换内存。。。不幸的是,我不知道为什么=/对我来说交换太小了谢谢Sagar Ranglani=D
namespace :deploy do

  namespace :assets do
    task :precompile do
      on roles(fetch(:assets_roles)) do
        within release_path do
          with rails_env: fetch(:rails_env) do
            execute :rake, "assets:precompile RAILS_ENV=production"
          end
        end
      end
    end
  end
end