ruby-on-rails - Rails Capistrano 在 Assets :precompile SSHKIT 上失败

标签 ruby-on-rails ruby webpack ssh capistrano

当我将应用程序部署到 Digital Ocean (Ubuntu 18.04) 时。部署过程失败 deploy:assets:precompile。它不提供特定的错误。我浏览了很多类似的案例,但都没有解决问题。

我检查了我的 ssh 设置,它们似乎是正确的。 ssh_config 中的 #AllowAgentForwarding 设置设置为 yes(本地和远程)。 ssh-add -l alsi 返回正确的 ssh 代理

有什么想法吗?谢谢您的帮助!

以下是我的错误输出:


00:09 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
      01 I, [2019-07-11T10:37:53.282876 #17762]  INFO -- sentry: ** [Raven] Raven 2.9.0 ready to catch errors
      01 yarn install v1.16.0
      01 [1/4] Resolving packages...
      01 [2/4] Fetching packages...
      01 info fsevents@1.2.9: The platform "linux" is incompatible with this module.
      01 info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
      01 info fsevents@2.0.7: The platform "linux" is incompatible with this module.
      01 info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
      01 [3/4] Linking dependencies...
      01 [4/4] Building fresh packages...
      01 Done in 22.00s.
      01 Compiling…
      01 Compilation failed:
      01
      01
#<Thread:0x00007fbb8d3ba470@/Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    13: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
    12: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:31:in `run'
    11: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
    10: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/capistrano-rails-1.4.0/lib/capistrano/tasks/assets.rake:67:in `block (4 levels) in <top (required)>'
     9: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:92:in `within'
     8: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/capistrano-rails-1.4.0/lib/capistrano/tasks/assets.rake:68:in `block (5 levels) in <top (required)>'
     7: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:100:in `with'
     6: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/capistrano-rails-1.4.0/lib/capistrano/tasks/assets.rake:69:in `block (6 levels) in <top (required)>'
     5: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:80:in `execute'
     4: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
     3: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:148:in `tap'
     2: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
     1: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/backends/netssh.rb:169:in `execute_command'
/Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/command.rb:97:in `exit_status=': rake exit status: 1 (SSHKit::Command::Failed)
rake stdout: I, [2019-07-11T10:37:53.282876 #17762]  INFO -- sentry: ** [Raven] Raven 2.9.0 ready to catch errors
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.7: The platform "linux" is incompatible with this module.
info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 22.00s.
Compiling…
Compilation failed:
rake stderr: Nothing written
    1: from /Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/sebastiaan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@134.209.201.210: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: I, [2019-07-11T11:12:13.618508 #20267]  INFO -- sentry: ** [Raven] Raven 2.9.0 ready to catch errors
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.7: The platform "linux" is incompatible with this module.
info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 22.95s.
Compiling…
Compilation failed:
rake stderr: Nothing written

头文件:
require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
require "capistrano/rbenv"
require "capistrano/rails"
require "capistrano/passenger"
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
set :rbenv_type, :user
set :rbenv_ruby, '2.6.3'





部署文件
lock "~> 3.11.0"
set :application, "youba"
set :repo_url, "git@bitbucket.org:pspoppen/youba.git"
set :deploy_to, "/home/deploy/#{fetch :application}"
append :linked_files, 'config/database.yml'
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads'
set :keep_releases, 10
set :ssh_options, { forward_agent: true }

Gemfile(相关 gem )
gem 'capistrano', '~> 3.11'
gem 'capistrano-rails', '~> 1.4'
gem 'capistrano-passenger', '~> 0.2.0'
gem 'capistrano-rbenv', '~> 2.1', '>= 2.1.4'
gem 'webpacker', '~> 4.x'

最佳答案

@Nordic Panda 和 @Claasz,谢谢你们的帮助!内存不足确实是问题,导致编译失败。我调整了我的 Digital Ocean 帐户的大小,现在部署工作正常!

在我这样做之前(并且仍然使用较轻的服务器)。我按照您的建议在本地编译了 Assets 并单独部署了它们。这也很好用!

关于ruby-on-rails - Rails Capistrano 在 Assets :precompile SSHKIT 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56987929/

相关文章:

ruby-on-rails - Flash 消息在 IE 中显示不一致

ruby-on-rails - 使用 Formtastic 分配嵌套属性

javascript - vuejs 延迟加载组件,无需路由器

ruby-on-rails - Rails/Ruby创建数据库报错: Unable to load the EventMachine C extension

ruby-on-rails - 如何在 Ruby on Rails 中跨请求保留查询字符串值?

ruby-on-rails - 如何更改 Rails 应用程序数据?

ruby-on-rails - Ruby On Rails 查询总和和组?

mysql - Rails 中包含条件的奇怪行为

javascript - 为什么 webpack 在打包时不包含assert.rejects(UMD 库目标)

webpack - webpack-删除 “webpackBootstrap”代码