2013-05-10 54 views
1

我正在使用passenger + nginx來部署Rails應用程序。我遇到的問題是,bundler在嘗試安裝它時找不到任何寶石。舉例來說,我得到這個錯誤:生產服務器上的Bundler找不到任何寶石

Could not find i18n-0.6.1 in any of the sources (Bundler::GemNotFound) 

如果我登錄到我的生產箱並手動安裝寶石,錯誤消失,但隨後需要在未來創業板無法找到。爲什麼是這樣?我是而不是使用rvm。這是我的配置文件:

worker_processes 1; 

events { 
    worker_connections 1024; 
} 


http { 
    passenger_root /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.0.rc4; 
    passenger_ruby /usr/local/bin/ruby; 

    include  mime.types; 
    default_type application/octet-stream; 

    sendfile  on; 

    keepalive_timeout 65; 

    server { 
     listen  80; 
     server_name .treadforth.com; 
     root /var/www/Tread-Forth/current/public; 
     passenger_enabled on; 
    } 
} 

編輯:我應該補充說,nginx以root身份運行。這可能是一個路徑問題,但手動安裝gems允許bundle識別它們被安裝,所以我不確定。

+1

你在使用capistrano嗎?你把'require'bundler/capistrano''行添加到'deploy.rb'嗎? – depa 2013-05-10 01:40:56

+0

謝謝你解決了這個問題。如果你添加這個答案,我會接受。 – Max 2013-05-10 01:47:26

+0

不錯!我很高興地知道。 – depa 2013-05-10 02:13:52

回答

1

如果您使用Capistrano的,你需要添加下面的一行到config/deploy.rb

require 'bundler/capistrano' 

除非你添加,斯特拉努不會在遠程服務器上運行bundle install,同時部署。它還增加了--deployment選項,可將所有寶石安裝在shared/bundle之下,從而爲您的應用程序創建一個很好的分離寶石環境。

相關問題