简体   繁体   中英

Bundler on production server can't find any gems

I am using passenger + nginx to deploy a rails app. The problem I am having is that bundler is not finding any gems when it tries to install them. For instance, I am getting this error:

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

If I log onto my production box and manually install the gem, the error goes away, but then the next gem needed cannot be found. Why is this? I am not using rvm. Here is my config file:

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;
    }
}

Edit: I should add that nginx is running as root. It is possible this is a path issue, but installing the gems manually allows bundle to recognize that they are installed so I am not sure.

If you're using capistrano, you need to add the line below to config/deploy.rb

require 'bundler/capistrano'

Unless you add that, capistrano won't run bundle install on the remote server while deploying. It also adds the --deployment option that installs all your gems under shared/bundle , thereby making a nice separated gem environment for your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM