使用gem paperclip时使用cap deploy进行部署时出错

时间:2012-05-06 17:14:10

标签: ruby-on-rails-3 paperclip capistrano

我正在使用gem Paperclip,现在我想使用capistrano将我的应用程序部署到服务器,但是当运行cap deploy时,我在最后得到以下消息:

 * executing "cd /home/administrator/myApp/releases/20120506165329 && bundle install --gemfile /home/administrat
or/myApp/releases/20120506165329/Gemfile --path /home/administrator/myApp/shared/bundle --deployment --qui
et --without development test"
    servers: ["myserver.com"]
    [myserver.com] executing command
 ** [out :: myserver.com] Gem::InstallError: paperclip requires Ruby version >= 1.9.2.
 ** [out :: myserver.com] An error occured while installing paperclip (3.0.3), and Bundler cannot continue.
 ** [out :: myserver.com] Make sure that `gem install paperclip -v '3.0.3'` succeeds before bundling.
    command finished in 66362ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/administrator/myApp/releases/20120506165329; true"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished in 66ms
failed: "sh -c 'cd /home/administrator/myApp/releases/20120506165329 && bundle install --gemfile /home/administra
tor/myApp/releases/20120506165329/Gemfile --path /home/administrator/myApp/shared/bundle --deployment --qu
iet --without development test'" on myserver.com

我已经检查了服务器中的Ruby版本,我得到了:

$ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

我还通过运行

在服务器中手动安装了gem
gem install paperclip -v '3.0.3'
...
Successfully installed paperclip-3.0.3

再次运行cap deploy,但同样的消息显示

如何部署我的应用?

提前感谢你

1 个答案:

答案 0 :(得分:0)

通过设置capistrano的默认环境来修复它,如接受的答案中所建议的那样here

我现在可以使用capistrano进行部署(虽然我的系统ruby仍在使用ruby 1.8.7,因此宝石回形针无法正确安装,您可以找到此问题here