我正在AWS EC2实例上托管Rails应用程序,并通过Capistrano部署我的应用程序。在部署期间,我能够通过安装缺少的工具(如Monit)来解决错误。但是,我对此错误感到困惑:puma stderr: bash: bundle: command not found
。我看到捆绑器已安装在服务器上,但是当我键入bundle
时,终端会显示Could not locate Gemfile
。我什至尝试重新安装捆绑程序gem install bundler
,但仍然无法识别bundle命令。我在下面列出了有关我的部署目标的详细信息。我不确定该怎么办,将不胜感激。
gem环境返回:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /home/ubuntu/.rbenv/versions/2.6.5/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- /home/ubuntu/.gem/ruby/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ubuntu/.rbenv/versions/2.6.5/bin
- /home/ubuntu/.rbenv/libexec
- /home/ubuntu/.rbenv/plugins/ruby-build/bin
- /home/ubuntu/.rbenv/shims
- /home/ubuntu/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
echo $PATH
返回
/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
which gem
返回
/home/ubuntu/.rbenv/shims/gem
locate bundle
返回
/home/ubuntu/.gem/specs/rubygems.org%443/quick/Marshal.4.8/bundler-1.17.1.gemspec
/home/ubuntu/.rbenv/shims/bundle
/home/ubuntu/.rbenv/shims/bundler
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundle
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/build_metadata.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/capistrano.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli.rb
...
答案 0 :(得分:0)
如果使用捆绑软件,则应添加capistrano-bundler
。参见GitHub issue
答案 1 :(得分:0)
似乎某些彪马设置被覆盖。我将以下行添加到deploy.rb
:set :rbenv_map_bins, %w{rake gem bundle ruby rails puma pumactl}
中来克服此错误。
链接到解决方案: https://github.com/seuros/capistrano-puma/issues/206