Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
382 views
in Technique[技术] by (71.8m points)

ruby on rails - Bundler Error when attempting Capistrano Deployment

I am attempting to deploy a ruby on rails web app to a staging server but continue to get the error: bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)

I have attempted to install bundler on the server directly, and even after doing so it continues to fail with the same error. Full error log and deploy.rb below.

Full Log:

   % cap staging deploy
[Deprecation Notice] Future versions of Capistrano will not load the Git SCM
plugin by default. To silence this deprecation warning, add the following to
your Capfile after `require "capistrano/deploy"`:

    require "capistrano/scm/git"
    install_plugin Capistrano::SCM::Git

[email protected]'s password:
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
ruby-2.7.0
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
00:00 git:wrapper
      01 mkdir -p /home/deploy/tmp
    ? 01 [email protected] 0.313s
      Uploading /home/deploy/tmp/git-ssh-Myapp-staging-marcuselmer.sh 100.0%
      02 chmod 700 /home/deploy/tmp/git-ssh-Myapp-staging-marcuselmer.sh
    ? 02 [email protected] 0.276s
00:01 git:check
      01 git ls-remote [email protected]:.../myApp.git HEAD
      01 123abad2c0a3f9fa670259253608e11086661c6b   HEAD
    ? 01 [email protected] 1.653s
00:02 deploy:check:directories
      01 mkdir -p /home/deploy/apps/MYAPP/shared /home/deploy/apps/MYAPP/releases
    ? 01 [email protected] 0.278s
00:03 deploy:check:linked_dirs
      01 mkdir -p /home/deploy/apps/MYAPP/shared/log /home/deploy/apps/MYAPP/shared/tmp/pids /home/deploy/apps/MYAPP/shared/tmp/cache /home/deploy/app…
    ? 01 [email protected] 0.319s
00:03 deploy:check:make_linked_dirs
      01 mkdir -p /home/deploy/apps/MYAPP/shared/config
    ? 01 [email protected] 0.274s
00:04 git:clone
      The repository mirror is at /home/deploy/apps/MYAPP/repo
00:05 git:update
      01 git remote set-url origin [email protected]:.../myApp.git
    ? 01 [email protected] 0.314s
      02 git remote update --prune
      02 Fetching origin
      02 From bitbucket.org:.../myApp
      02    01e45c6b..123abad2  master     -> master
    ? 02 [email protected] 1.901s
00:07 git:create_release
      01 mkdir -p /home/deploy/apps/MYAPP/releases/20201230174246
    ? 01 [email protected] 0.312s
      02 git archive master | /usr/bin/env tar -x -f - -C /home/deploy/apps/MYAPP/releases/20201230174246
    ? 02 [email protected] 0.924s
00:09 deploy:set_current_revision
      01 echo "123abad2c0a3f9fa670259253608e11086661c6b" >> REVISION
    ? 01 [email protected] 0.269s
00:09 deploy:symlink:linked_files
      01 mkdir -p /home/deploy/apps/MYAPP/releases/20201230174246/config
    ? 01 [email protected] 0.317s
      02 ln -s /home/deploy/apps/MYAPP/shared/config/secrets.yml /home/deploy/apps/MYAPP/releases/20201230174246/config/secrets.yml
    ? 02 [email protected] 0.277s
00:11 deploy:symlink:linked_dirs
      01 mkdir -p /home/deploy/apps/MYAPP/releases/20201230174246 /home/deploy/apps/MYAPP/releases/20201230174246/tmp /home/deploy/apps/MYAPP/releases…
    ? 01 [email protected] 0.307s
      02 rm -rf /home/deploy/apps/MYAPP/releases/20201230174246/log
    ? 02 [email protected] 0.269s
      03 ln -s /home/deploy/apps/MYAPP/shared/log /home/deploy/apps/MYAPP/releases/20201230174246/log
    ? 03 [email protected] 0.335s
      04 ln -s /home/deploy/apps/MYAPP/shared/tmp/pids /home/deploy/apps/MYAPP/releases/20201230174246/tmp/pids
    ? 04 [email protected] 0.272s
      05 rm -rf /home/deploy/apps/MYAPP/releases/20201230174246/tmp/cache
    ? 05 [email protected] 0.318s
      06 ln -s /home/deploy/apps/MYAPP/shared/tmp/cache /home/deploy/apps/MYAPP/releases/20201230174246/tmp/cache
    ? 06 [email protected] 0.283s
      07 ln -s /home/deploy/apps/MYAPP/shared/tmp/sockets /home/deploy/apps/MYAPP/releases/20201230174246/tmp/sockets
    ? 07 [email protected] 0.308s
      08 ln -s /home/deploy/apps/MYAPP/shared/vendor/bundle /home/deploy/apps/MYAPP/releases/20201230174246/vendor/bundle
    ? 08 [email protected] 0.277s
      09 ln -s /home/deploy/apps/MYAPP/shared/public/system /home/deploy/apps/MYAPP/releases/20201230174246/public/system
    ? 09 [email protected] 0.314s
      10 ln -s /home/deploy/apps/MYAPP/shared/public/assets /home/deploy/apps/MYAPP/releases/20201230174246/public/assets
    ? 10 [email protected] 0.268s
00:19 bundler:install
      01 ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/MYAPP/shared/bundle --without development test --deployment --quiet
      01 /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by y…
      01 To update to the latest version installed on your system, run `bundle update --bundler`.
      01 To install the missing version, run `gem install bundler:1.16.1`
      01    from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
      01    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
      01    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
      01    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
    from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'


Caused by:
SSHKit::Command::Failed: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
    from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'

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 [email protected]: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
    from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


 DEBUG [9486807a] Finished in 0.308 seconds with exit status 0 (successful).

 DEBUG [5d323bc9] Running ~/.rvm/bin/rvm default do bundle check --path /home/deploy/apps/MYAPP/shared/bundle as [email protected]

 DEBUG [5d323bc9] Command: cd /home/deploy/apps/MYAPP/releases/20201230174246 && ~/.rvm/bin/rvm default do bundle check --path /home/deploy/apps/MYAPP/shared/bundle

 DEBUG [5d323bc9]   /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)

To update to the latest version installed on your system, run `bundle update --bundler`.

To install the missing version, run `gem install bundler:1.16.1`

    from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'

    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'

    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'

    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'

 DEBUG [5d323bc9] Finished in 0.648 seconds with exit status 1 (failed).

  INFO [38f3d295] Running ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/MYAPP/shared/bundle --without development test --deployment --quiet as [email protected]

 DEBUG [38f3d295] Command: cd /home/deploy/apps/MYAPP/releases/20201230174246 && ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/MYAPP/shared/bundle --without development test --deployment --quiet

 DEBUG [38f3d295]   /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)

To update to the latest version installed on your system, run `bundle update --bundler`.

To install the missing version, run `gem install bundler:1.16.1`

    from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'

    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'

    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'

    from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'

Deploy.rb

# config valid only for current version of Capistrano
lock "3.10.1"

set :application, "Myapp"
set :repo_url, '[email protected]:…/myApp.git'

set :deploy_to, '/home/deploy/apps/myApp

set :linked_files, %w{config/secrets.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :tmp_dir, "/home/deploy/tmp"
set :branch, ENV['BRANCH'] if ENV['BRANCH']
set :user, "deploy"


# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp

# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, "/var/www/my_app_name"

# Default value for :format is :airbrussh.
# set :format, :airbrussh

# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was able to get past this blocker. The ultimate issue is that I had to log into the correct shell and run gem install bundler:1.16.1.

In order to log into the bash I used this command: /bin/bash --login

Then run gem install: gem install bundler:1.16.1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...