在rbenv中升级ruby版本时,Capistrano部署失败

时间:2014-06-24 14:43:01

标签: ruby-on-rails ruby

当我在rails项目目录中运行cap production deploy时,出现如下错误:

INFO[6be9dff4] Running RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.1 /usr/local/rbenv/bin/rbenv exec bundle install --binstubs /var/www/example.com/shared/bin --path /var/www/example.com/shared/bundle --without development test --deployment --quiet on example.com
DEBUG[6be9dff4] Command: cd /var/www/example.com/releases/20140624143014 && ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.1 RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.1 /usr/local/rbenv/bin/rbenv exec bundle install --binstubs /var/www/example.com/shared/bin --path /var/www/example.com/shared/bundle --without development test --deployment --quiet )
DEBUG[6be9dff4]     Errno::EACCES: Permission denied @ rb_sysopen - /var/www/example.com/shared/bundle/ruby/2.1.0/cache/rake-10.3.2.gem
DEBUG[6be9dff4]     An error occurred while installing rake (10.3.2), and Bundler cannot continue.
DEBUG[6be9dff4]     Make sure that `gem install rake -v '10.3.2'` succeeds before bundling.

所以我登录服务器并将用户更改为部署用户,然后运行如下命令:

$ su - deployer
Password: 
deployer@server ~$ cd /var/www/example.com/releases/20140624143014 && ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.1 RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.1 /usr/local/rbenv/bin/rbenv exec bundle install --binstubs /var/www/example.com/shared/bin --path /var/www/example.com/shared/bundle --without development test --deployment --quiet )
Errno::EACCES: Permission denied @ rb_sysopen - /var/www/example.com/shared/bundle/ruby/2.1.0/cache/rake-10.3.2.gem
An error occurred while installing rake (10.3.2), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.2'` succeeds before bundling.

rbenvruby的安装方式如下:

$ rbenv versions
  system
  2.0.0-p451
* 2.1.1 (set by /usr/local/rbenv/version)

我使用LinuxMint16CentOS 6.5部署到Capistrano 3并且在使用2.0.0-p451之前部署成功。

我应该如何检查以及找出导致错误的原因?

0 个答案:

没有答案