部署 Ubuntu 16.04 上使用 Nginx + Passenger 部署 Ruby on Rails 错误

lijianweicode · 2019年01月06日 · 最后由 lijianweicode 回复于 2019年01月10日 · 6721 次阅读

错误如下

#<Thread:0x0000560e23c65ed0@/home/lee/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /home/lee/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/lee/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: bundle exit status: 1 (SSHKit::Runner::ExecuteError)
bundle stdout: Nothing written
bundle stderr: rbenv: version `2.5.0' is not installed (set by RBENV_VERSION environment variable)
(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: rbenv: version `2.5.0' is not installed (set by RBENV_VERSION environment variable)


Caused by:
SSHKit::Command::Failed: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: rbenv: version `2.5.0' is not installed (set by RBENV_VERSION environment variable)

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: rbenv: version `2.5.0' is not installed (set by RBENV_VERSION environment variable)


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


  INFO [040b39b5] Finished in 0.685 seconds with exit status 0 (successful).

 DEBUG [7bb45134] Running [ -L /home/deploy/deployment/releases/20190105154412/public/assets ] as [email protected]

 DEBUG [7bb45134] Command: [ -L /home/deploy/deployment/releases/20190105154412/public/assets ]

 DEBUG [6f6d8ef1] Finished in 0.722 seconds with exit status 1 (failed).

 DEBUG [7991f930] Running [ -d /home/deploy/deployment/releases/20190105154412/public/assets ] as [email protected]

 DEBUG [7991f930] Command: [ -d /home/deploy/deployment/releases/20190105154412/public/assets ]

 DEBUG [507a5d03] Finished in 0.720 seconds with exit status 1 (failed).

  INFO [36827229] Running /usr/bin/env ln -s /home/deploy/deployment/shared/public/assets /home/deploy/deployment/releases/20190105154412/public/assets as [email protected]

 DEBUG [36827229] Command: ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="" ; /usr/bin/env ln -s /home/deploy/deployment/shared/public/assets /home/deploy/deployment/releases/20190105154412/public/assets )

  INFO [7e8048e2] Finished in 0.998 seconds with exit status 0 (successful).

 DEBUG [6d22b913] Running if test ! -d /home/deploy/deployment/releases/20190105154412; then echo "Directory does not exist '/home/deploy/deployment/releases/20190105154412'" 1>&2; false; fi as [email protected]

 DEBUG [6d22b913] Command: if test ! -d /home/deploy/deployment/releases/20190105154412; then echo "Directory does not exist '/home/deploy/deployment/releases/20190105154412'" 1>&2; false; fi

 DEBUG [2d0b7078] Finished in 0.676 seconds with exit status 0 (successful).

 DEBUG [e8892882] Running $HOME/.rbenv/bin/rbenv exec bundle check --path /home/deploy/deployment/shared/bundle as [email protected]

 DEBUG [e8892882] Command: cd /home/deploy/deployment/releases/20190105154412 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="" ; $HOME/.rbenv/bin/rbenv exec bundle check --path /home/deploy/deployment/shared/bundle )

 DEBUG [09a82258]   rbenv: version `2.5.0' is not installed (set by RBENV_VERSION environment variable)

 DEBUG [09a82258] Finished in 0.720 seconds with exit status 1 (failed).

  INFO [96fc03ec] Running $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/deployment/shared/bundle --jobs 4 --without development test --deployment --quiet as [email protected]

 DEBUG [96fc03ec] Command: cd /home/deploy/deployment/releases/20190105154412 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="" ; $HOME/.rbenv/bin/rbenv exec bundle install --path /home/deploy/deployment/shared/bundle --jobs 4 --without development test --deployment --quiet )

 DEBUG [ff832761]   rbenv: version `2.5.0' is not installed (set by RBENV_VERSION environment variable)

这是怎么回事呀?

Bundler version 1.11.2

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

然后位置是/home/deploy/.rbenv/shims/ruby

你可以试试在 root 下,也装一个 rbenv

config/deploy/production.rb 文件里面加个设置 set :rbenv_type, :user

capistrano 有两种方式找 Ruby 版本,分别是 usersystem

42thcoder 回复

嗯嗯,部署好了!!很开心,网页上写出 Hello,world 了!!!!感谢老哥!!😆

Rei 回复

谢谢您!!部署好了!

需要 登录 后方可回复, 如果你还没有账号请 注册新账号