ruby-on-rails - "Could not find concurrent-ruby-1.

我在这里看到了很多类似的问题,但提供的建议都没有帮助。每次运行 cap production deploy 时,我都会遇到错误:

...
 DEBUG [9b1f0199] Running RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle check as deploy@199.192.25.241
 DEBUG [9b1f0199] Command: cd /home/deploy/project/releases/20201018151933 && ( export RAILS_ENV="production" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.5" ; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle check )
 DEBUG [9b1f0199]       Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
 DEBUG [9b1f0199] Finished in 1.400 seconds with exit status 7 (failed).
  INFO [f0be72cf] Running RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle install --jobs 1 --without development test --deployment --quiet as deploy@199.192.25.241
 DEBUG [f0be72cf] Command: cd /home/deploy/project/releases/20201018151933 && ( export RAILS_ENV="production" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.6.5" ; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec bundle install --jobs 1 --without development test --deployment --quiet )
 DEBUG [f0be72cf]       Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
#<Thread:0x00007feee097d1d8@/Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        13: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
        12: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:31:in `run'
        11: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
        10: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/capistrano-bundler-1.6.0/lib/capistrano/tasks/bundler.cap:26:in `block (3 levels) in <top (required)>'
         9: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:92:in `within'
         8: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/capistrano-bundler-1.6.0/lib/capistrano/tasks/bundler.cap:27:in `block (4 levels) in <top (required)>'
         7: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:100:in `with'
         6: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/capistrano-bundler-1.6.0/lib/capistrano/tasks/bundler.cap:39:in `block (5 levels) in <top (required)>'
         5: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:80:in `execute'
         4: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
         3: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:148:in `tap'
         2: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
         1: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/command.rb:97:in `exit_status=': bundle exit status: 7 (SSHKit::Command::Failed)
bundle stdout: Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
bundle stderr: Nothing written
        1: from /Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/ruslan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sshkit-1.21.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@199.192.25.241: bundle exit status: 7 (SSHKit::Runner::ExecuteError)
bundle stdout: Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
bundle stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@199.192.25.241: bundle exit status: 7
bundle stdout: Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
bundle stderr: Nothing written


Caused by:
SSHKit::Command::Failed: bundle exit status: 7
bundle stdout: Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
bundle stderr: Nothing written

Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@199.192.25.241: bundle exit status: 7
bundle stdout: Could not find concurrent-ruby-1.1.7 in any of the sources
Run `bundle install` to install missing gems.
bundle stderr: Nothing written

我的Capfile:

# frozen_string_literal: true

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'

# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require 'capistrano/scm/git'
install_plugin Capistrano::SCM::Git

# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#   https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
require 'capistrano/rbenv'
require 'capistrano/rails'
# require "capistrano/chruby"
require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
require 'capistrano/passenger'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

set :rbenv_type, :user
set :rbenv_ruby, '2.6.5'

我的Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

gem 'aasm'
gem 'aws-sdk-s3', require: false
gem 'bcrypt', require: 'bcrypt'
gem 'bootsnap', '>= 1.4.2', require: false
gem 'devise'
gem 'draper'
gem 'factory_bot_rails'
gem 'ffaker'
gem 'gon'
gem 'image_processing', '~> 1.2'
gem 'jbuilder', '~> 2.7'
gem 'mini_magick'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-line'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 4.1'
gem 'pundit'
gem 'rails', '~> 6.0.3'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'rollbar'
gem 'ruby-vips', '~> 2.0.17'
gem 'sass-rails', '>= 6'
gem 'serviceworker-rails'
gem 'slim-rails'
gem 'strong_migrations'
gem 'travis'
gem 'turbolinks', '~> 5'
gem 'webpacker', '~> 4.0'

group :development, :test do
  gem 'byebug', platforms: %i[mri mingw x64_mingw]
  gem 'rspec-rails', '~> 4.0.0'
end

group :development do
  gem 'capistrano', '~> 3.6'
  gem 'capistrano-bundler', '~> 1.6'
  gem 'capistrano-passenger', '~> 0.2.0'
  gem 'capistrano-rails', '~> 1.4'
  gem 'capistrano-rbenv', '~> 2.1', '>= 2.1.4'
  gem 'letter_opener'
  gem 'listen', '~> 3.2'
  gem 'rubocop'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'web-console', '>= 3.3.0'
end

group :test do
  gem 'capybara', '>= 2.15'
  gem 'database_cleaner-active_record'
  gem 'rails-controller-testing'
  gem 'selenium-webdriver'
  gem 'shoulda-matchers'
  gem 'simplecov', require: false
  gem 'webdrivers'
end

gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

第一条消息是关于 rollbar gem(部署是在我将这个 gem 添加到项目之后),但是当我运行 bundle update 时,我收到关于 concurrent-ruby-1.1.7 的错误.我已经试过了:

  1. 删除 Gemfile.lock
  2. 运行 bundle upadte 和 bundle install
  3. 将此代码添加到Capfile:
      set :default_environment, {
        :PATH => '$HOME/.rbenv/versions/2.6.5/bin:$PATH',
        :GEM_HOME => '$HOME/.rbenv/versions/2.6.5',
        :GEM_PATH => '$HOME/.rbenv/versions/2.6.5:$HOME/.rbenv/versions/2.6.5@global'
      }
  1. 运行 bundle exec cap production deploy:updated

cap production deploy:check 没有显示任何错误。我错过了什么?非常感谢您!

最佳答案

我是如何解决的:

  1. 转到服务器命令行
  2. 正如我们在错误日志中看到的,错误出现前的最后一条命令是:

命令:cd/home/deploy/project/releases/20201018151933 && ( export RAILS_ENV="production"RBENV_ROOT="$HOME/.rbenv"RBENV_VERSION="2.6.5"; RBENV_ROOT=$HOME/. rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec 包检查)

所以我们去我们的文件夹:

cd/home/deploy/project/releases/20201018151933

然后运行命令:

export RAILS_ENV="production"RBENV_ROOT="$HOME/.rbenv"RBENV_VERSION="2.6.5"; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.6.5 $HOME/.rbenv/shims/bundle exec 包检查

之后我们看到同样的错误:

无法在任何来源中找到 concurrent-ruby-1.1.7。运行“bundle install”以安装缺少的 gem。

  1. 在同一文件夹中运行 bundle install 并在安装 gem 后我们可以退出服务器命令行。
  2. 运行 cap production deploy 一切都会好起来的。

我仍然不知道这个错误的根本问题是什么,以及如何永久修复它,但这对我有用。我希望它对其他人有用。

关于ruby-on-rails - "Could not find concurrent-ruby-1.1.7 in any of the sources"使用 capistrano 部署 rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64415137/

相关文章:

html - 空白 nowrap 但如果大于 css 中的最大宽度则换行

github - 使用另一个存储库的 github 操作工作流文件

reactjs - 我怎么能告诉 typescript Prop 来自 react 克隆元素?

.htaccess - 使用指向 page.php 的 1 个参数编写干净的 URLS

qt - 带有在运行时加载的自定义 QML 插件的基于 CMake 的项目仅在 MinGW 下失败

javascript - 浏览器客户端如何在没有像 Apollo 或 Relay 这样的库的情况下使

r - 如何使用 ggplot 自定义多面图中的背景颜色

docker - 每个命令都会导致 fatal error : runtime: out of me

google-sheets - Google 表格中的 ArrayFormula 和 "AND"公式

python - 如何在 Python 中删除 .txt 文件的前几行?