afa*_*ley 6 ruby-on-rails bundler ubuntu-20.04
我有一个在 Ubuntu 18.04 上运行的 Rails 项目,我刚刚将系统升级到 Ubuntu 20.04。
cap production deploy
在以下步骤中失败deploy:assets:precompile
:
00:07 deploy:assets:precompile
01 /home/deploy/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 bundler: failed to load command: rake (/var/www/framelinker/shared/bundle/ruby/2.6.0/bin/rake)
01 Gem::Exception: can't find executable rake for gem rake. rake is not currently included in the bundle, perhaps you meant to add it to your Gemfile?
Run Code Online (Sandbox Code Playgroud)
我尝试将 rake 添加到我的 gemfile 中,尽管我有一种感觉这不是答案,因为 a) 它没有任何区别,b) 当一切都在 Ubuntu 18.04 上运行时,rake 不在我的 gemfile 中。
谷歌搜索告诉我要运行gem update --system
,但我不想手动弄乱服务器。
我在服务器上使用 rbenv。我的 gemfile 被锁定在 ruby 2.6.1。
这里发生了什么?rake 本质上不是内置于 ruby 中的吗?为什么我必须将它添加到 gemfile 中?
--------------- 编辑 --------------
我想知道 Capistrano 是否应该使用这样的东西,而不是上面所做的:
/home/deploy/.rbenv/bin/rbenv/shims/rake assets:precompile
Run Code Online (Sandbox Code Playgroud)
我的 Capfile 内容:
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require 'capistrano/sidekiq'
install_plugin Capistrano::Sidekiq # Default sidekiq tasks
# Then select your service manager
install_plugin Capistrano::Sidekiq::Systemd
# 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/chruby"
require "capistrano/bundler"
require "capistrano/rails/assets"
require 'capistrano/rails/collection'
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 }
Run Code Online (Sandbox Code Playgroud)
登录服务器并手动执行以下命令修复了此问题:
/home/deploy/.rbenv/bin/rbenv exec gem update --system
Run Code Online (Sandbox Code Playgroud)
从可重复性/CI 的角度来看,这并不令人满意,但至少它给了我一些可以继续的东西,并且我的服务器再次运行。
归档时间: |
|
查看次数: |
4582 次 |
最近记录: |