使用Bundler安装Gems ==大问题

时间:2021-02-15 00:18:45

If I run bundle install , everything passes. I reboot nginx, and when I visit the site I see the passenger error with this :

如果我运行bundle install,一切都会通过。我重新启动nginx,当我访问该网站时,我看到乘客错误:

git://github.com/spree/spree.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)

My gemfile :

我的gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'spree', :git => 'git://github.com/spree/spree.git' 
gem 'haml'
gem 'ruby-debug'
gem 'sqlite3', :require => 'sqlite3'
gem 'ckeditor', '3.4.2.pre'
gem "aged_revolt", :require => "aged_revolt", :path => "aged_revolt"
gem "spree_easy_contact", '1.0.2', :path => "#{File.expand_path(__FILE__)}/../vendor/gems/spree_easy_contact-1.0.2"
gem "honeypot-captcha"

When I run bundle show spree :

当我运行bundle show spree时:

/home/shadyfront/.rvm/gems/ruby-1.8.7-p330@revolting_gems/bundler/gems/spree-44e4771f3a2a

Any idea how/why this is occuring and how I can get past this ?

知道如何/为什么会发生这种情况以及如何解决这个问题?

This is my nginx.conf :

这是我的nginx.conf:

env               GEM_HOME=/home/shadyfront/.rvm/gems/ruby-1.8.7-p330@revolting_gems;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    access_log  /home/shadyfront/logs/user/access_revolting_age.log  combined;
    error_log   /home/shadyfront/logs/user/error_revolting_age.log   crit;

    include         mime.types;
    passenger_root  /home/shadyfront/webapps/revolting_age/gems/gems/passenger-2.2.15;
    passenger_ruby  /home/shadyfront/webapps/revolting_age/bin/ruby;
    sendfile        on;

    passenger_max_instances_per_app  1;
    rails_spawn_method               conservative;
    passenger_max_pool_size 2;

    server {
        listen             56943;
        passenger_enabled  on;
        root               /home/shadyfront/webapps/revolting_age/releases/20110215175319/public;
        server_name        localhost;
    }
}

5 个解决方案

#1


23  

This problem seems to be a bug in either passenger or bundler when dealing with git-based gems. This "solution" (I'm writing vendor instead of vender...) got my passenger running right now:

在处理基于git的宝石时,这个问题似乎是乘客或捆绑者中的一个错误。这个“解决方案”(我正在写供应商而不是供应商......)让我的乘客现在正在运行:

  1. bundle pack
  2. bundle install --path vendor/cache
  3. bundle install --path vendor / cache

I think http://www.ruby-forum.com/topic/213962 is the same issue and it's not resolved as far as I know. May this bug be fixed soon...

我认为http://www.ruby-forum.com/topic/213962是同一个问题,据我所知它还没有解决。可能很快就会修复这个bug ...

#2


1  

Are you sure it's not a problem with your version # for spree? There's no such tag or version '0.50.99' that I can see of on github.

你确定你的版本#对于狂欢来说不是问题吗?我在github上看不到这样的标签或版本'0.50.99'。

Edit:

The only other thing I can think of is that since spree is a container of other gem dependencies, bundler doesn't like you defining the requirement this way.

我能想到的另一件事是,由于spree是其他gem依赖项的容器,因此bundler不喜欢用这种方式定义需求。

A git repository SHOULD have at least one file, at the root of the directory containing the gem, with the extension .gemspec. This file MUST contain a valid gem specification, as expected by the gem build command. It MUST NOT have any dependencies, other than on the files in the git repository itself and any built-in functionality of Ruby or Rubygems.

一个git存储库应该至少有一个文件,位于包含gem的目录的根目录下,扩展名为.gemspec。这个文件必须包含一个有效的gem规范,正如gem build命令所期望的那样。它不能有任何依赖,除了git存储库本身的文件和Ruby或Rubygems的任何内置功能。

This comes from the manpage for bundler.

这来自bundler的联机帮助页。

#3


1  

That is because you also have to address where the gem location ( specifically where bundler is installed ) in your nginx start script as well.

这是因为您还必须在nginx启动脚本中解决gem位置(特别是安装了bundler的位置)。

bin/start

#!/bin/bash

TMPDIR=/home/shadyfront/webapps/truejersey/tmp GEM_HOME=/home/shadyfront/.rvm/gems/ruby-1.8.7-p330@true /home/shadyfront/webapps/truejersey/nginx/sbin/nginx -p /home/shadyfront/webapps/truejersey/nginx/

#4


0  

I faced this problem in Feb 2015 and installing gem locally in project directory fix it for me.

我在2015年2月遇到了这个问题,并在项目目录中本地安装gem为我修复了它。

 $ bundle install --path vendor/bundle

#5


0  

The easiest workaround would be to install all gems locally by running

最简单的解决方法是通过运行在本地安装所有gem

bundle install --path vendor/bundle

The cleaner way is to keep your gems in their GEM_HOME (which might e.g. be managed by rvm) and point to this directory from vendor/bundle:

更简洁的方法是将您的宝石保存在他们的GEM_HOME中(可能由rvm管理)并从vendor / bundle指向此目录:

Step by step:

一步步:

  • In your project create a directory vendor/bundle/ruby/
  • 在您的项目中创建目录vendor / bundle / ruby​​ /

  • From command line create a symlink (replace 2.1.0 with your ruby version):

    从命令行创建符号链接(用您的ruby版本替换2.1.0):

    ln -s $GEM_HOME 2.1.0
    
  • Make sure that you have a file .bundle/config in your project directory which contains the line

    确保项目目录中包含该行的.bundle / config文件

    BUNDLE_PATH: vendor/bundle
    

That's it. You can now continue using 'bundle install' as always but also git gems will be referenced correctly.

而已。您现在可以继续使用'bundle install',但也可以正确引用git gems。

#1


23  

This problem seems to be a bug in either passenger or bundler when dealing with git-based gems. This "solution" (I'm writing vendor instead of vender...) got my passenger running right now:

在处理基于git的宝石时,这个问题似乎是乘客或捆绑者中的一个错误。这个“解决方案”(我正在写供应商而不是供应商......)让我的乘客现在正在运行:

  1. bundle pack
  2. bundle install --path vendor/cache
  3. bundle install --path vendor / cache

I think http://www.ruby-forum.com/topic/213962 is the same issue and it's not resolved as far as I know. May this bug be fixed soon...

我认为http://www.ruby-forum.com/topic/213962是同一个问题,据我所知它还没有解决。可能很快就会修复这个bug ...

#2


1  

Are you sure it's not a problem with your version # for spree? There's no such tag or version '0.50.99' that I can see of on github.

你确定你的版本#对于狂欢来说不是问题吗?我在github上看不到这样的标签或版本'0.50.99'。

Edit:

The only other thing I can think of is that since spree is a container of other gem dependencies, bundler doesn't like you defining the requirement this way.

我能想到的另一件事是,由于spree是其他gem依赖项的容器,因此bundler不喜欢用这种方式定义需求。

A git repository SHOULD have at least one file, at the root of the directory containing the gem, with the extension .gemspec. This file MUST contain a valid gem specification, as expected by the gem build command. It MUST NOT have any dependencies, other than on the files in the git repository itself and any built-in functionality of Ruby or Rubygems.

一个git存储库应该至少有一个文件,位于包含gem的目录的根目录下,扩展名为.gemspec。这个文件必须包含一个有效的gem规范,正如gem build命令所期望的那样。它不能有任何依赖,除了git存储库本身的文件和Ruby或Rubygems的任何内置功能。

This comes from the manpage for bundler.

这来自bundler的联机帮助页。

#3


1  

That is because you also have to address where the gem location ( specifically where bundler is installed ) in your nginx start script as well.

这是因为您还必须在nginx启动脚本中解决gem位置(特别是安装了bundler的位置)。

bin/start

#!/bin/bash

TMPDIR=/home/shadyfront/webapps/truejersey/tmp GEM_HOME=/home/shadyfront/.rvm/gems/ruby-1.8.7-p330@true /home/shadyfront/webapps/truejersey/nginx/sbin/nginx -p /home/shadyfront/webapps/truejersey/nginx/

#4


0  

I faced this problem in Feb 2015 and installing gem locally in project directory fix it for me.

我在2015年2月遇到了这个问题,并在项目目录中本地安装gem为我修复了它。

 $ bundle install --path vendor/bundle

#5


0  

The easiest workaround would be to install all gems locally by running

最简单的解决方法是通过运行在本地安装所有gem

bundle install --path vendor/bundle

The cleaner way is to keep your gems in their GEM_HOME (which might e.g. be managed by rvm) and point to this directory from vendor/bundle:

更简洁的方法是将您的宝石保存在他们的GEM_HOME中(可能由rvm管理)并从vendor / bundle指向此目录:

Step by step:

一步步:

  • In your project create a directory vendor/bundle/ruby/
  • 在您的项目中创建目录vendor / bundle / ruby​​ /

  • From command line create a symlink (replace 2.1.0 with your ruby version):

    从命令行创建符号链接(用您的ruby版本替换2.1.0):

    ln -s $GEM_HOME 2.1.0
    
  • Make sure that you have a file .bundle/config in your project directory which contains the line

    确保项目目录中包含该行的.bundle / config文件

    BUNDLE_PATH: vendor/bundle
    

That's it. You can now continue using 'bundle install' as always but also git gems will be referenced correctly.

而已。您现在可以继续使用'bundle install',但也可以正确引用git gems。