gpt4 book ai didi

ruby-on-rails - Rails 4、Capistrano 3 在 bundle exec rake Assets :precompile and returns rake stdout: Nothing 期间失败

转载 作者:行者123 更新时间:2023-12-04 09:10:58 24 4
gpt4 key购买 nike

在 rake Assets 期间使用 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
>

这是我的 debloy.rb
# config valid only for Capistrano 3.1
lock '3.1.0'

set :application, 'Myapp'
set :repo_url, 'git@github.com:randomuser/myapp.git'

set :deploy_to, '/var/www/myapp'

set :rvm_ruby_version, 'ruby-2.0.0-p353'

set :log_level, :info

set :linked_files, %w{config/database.yml}

set :keep_releases, 20

# SSHKit.config.output_verbosity = :debug
SSHKit.config.output = $stdout
SSHKit.config.output_verbosity = Logger::DEBUG
SSHKit.config.command_map[:rake] = "bundle exec rake"
SSHKit.config.command_map[:rails] = "bundle exec rails"

set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}

namespace :deploy do

desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do

# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end

after :publishing, :restart

after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
within release_path do
execute :rake, 'cache:clear'
end
end
end

after :finishing, "deploy:cleanup"
end

您可以在此 Gist 上找到有关此问题的更多详细信息:
https://gist.github.com/richardsondx/10092890
我注意到即使我在 production.rb 中提到了环境,rake 任务中也没有提到它。它可以帮助用 RAILS_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 正在终止 Assets 预编译过程。

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

尝试这个:

  • 创建 1GB 交换内存
    sudo dd if=/dev/zero of=/usr/mem.swap bs=1M count=512
  • 使用第一步创建的交换内存
    sudo mkswap /usr/mem.swap
    sudo swapon /usr/mem.swap
  • 关于ruby-on-rails - Rails 4、Capistrano 3 在 bundle exec rake Assets :precompile and returns rake stdout: Nothing 期间失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22929628/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com