Gem :: LoadError在Gemfile中使用git repo时 [英] Gem::LoadError when using a git repo in Gemfile

查看:147
本文介绍了Gem :: LoadError在Gemfile中使用git repo时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我分叉了sinbook gem并将git repo添加到了我的Gemfile中。但是依赖于sinbook的 sinatra-authentication gem会抛出Gem :: LoadError。



为什么不使用正在使用的宝石的我的版本

Gemfile

 来源:rubygems 

gem'sinatra'
gem'sinatra-contrib'
gem'sequel'

gem'jruby-openssl'
gem'rack-flash'
gem'sinbook',git:'https://github.com/JamesGecko/sinbook'
gem'sinatra-authentication'

gem'json-jruby'

gem'coffee-script'
gem'therubyrhino'

错误 p>

  PS C:\users\james\code\portal> jruby -S bundle 
从http://rubygems.org / ........获取gem元数据
从http://rubygems.org/获取gem元数据..
获取https://github.com/JamesGecko/sinbook
安装可寻址(2.2.8)
安装backports(2.5.1)
安装bouncy-castle-java(1.5.0146.1)
安装coffee-script-source(1.3.1)
安装multi_json(1.2.0)
安装execjs(1.3.0)
安装coffee-script(2.2.0)
安装dm-core(1.2.0)
安装dm-migrations(1.2.0)
安装dm-timestamps(1.2.0)
安装dm-validations(1.2.0 )
安装eventmachine(0.12.10)
安装jruby-openssl(0.7.7)
安装json(1.5.0)
安装json-jruby(1.5.0)
安装机架(1.4.1)
安装机架闪存(0.1.2)
安装机架保护(1.2.0)
安装机架测试(0.6.1)
安装rufus-tokyo(1.0.7)
安装续集(3.34.1)
安装倾斜(1.3.3)
安装sinatra(1 .3.2)
使用https://github.com/JamesGecko/sinbook(主人)的sinbook(0.1.9.jamesgecko)
安装sinatra-authentication(0.4.1)
安装sinatra-contrib(1.3.1)
安装therubyrhino(1.73.2)
使用捆绑器(1.1.4)
捆绑已完成!使用`bundle show [gemname]`来查看捆绑的gem的安装位置。
PS C:\ users \ james\code\\ \\ portal> jruby .\app.rb
Gem :: LoadError:在[addressable-2.2.8,backports-2.5.1,bouncy-castle-java-1.5.0146.1中找不到sinbook(> = 0) bundler-1.1.4,coffee-script-2.2.0,coffee-script-source-1.3.1,dm-core-1.2.0,dm-migrations-1.2.0,dm-timestamps-1.2.0,dm- validations-1.2.0,eventmachine-0.12.10-java,execjs-1.3.0,jruby-openssl-0.7.7,jruby-win32ole-0.8.5,json-1.5.0-java,json-jruby-1.5。 0-java,multi_json-1.2.0,rack-1.4.1,rack-flash-0.1.2,rack-protection-1.2.0,rack-test-0.6.1,rake-0.9.2.2,rufus-tokyo- 1.0.7,续集3.34.1,sinatra-1.3.2,sinatra-authentication-0.4.1,sinatra-contrib-1.3.1,therubyrhino-1.73.2,tilt-1.3.3]
to_specs at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/dependency.rb:247
activate_dependencies at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared /rubygems/specification.rb:777
位于org / jruby / RubyArray.java:1611
activate_dependencies at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared /rubygems/specification.rb:766
在c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb处激活:750
在c:\\ dev下的try_activate /jruby-1.7.0.preview1/lib/ruby/shared/rubygems.rb:212
需要在c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb :59
需要在c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:55
(root)at .\app.rb:7

app.rb

  require'sinatra'
require'sinatra / reloader'
require'json'

require'digest / sha1'
require'rack- flash'
require'sinatra-authentication'

使用Rack :: Session :: Cookie,秘密:'foobar'
使用Rack :: Flash

$ ...


解决方案

添加要求bundler / setup到app.rb.它需要加载捆绑的环境。更多信息可以在捆绑器文档中找到。



由于您使用的是Sinatra,因此您可能还想查看使用config.ru


I forked the sinbook gem and added the git repo to my Gemfile. But the sinatra-authentication gem, which depends on sinbook, throws Gem::LoadError.

Why isn't my version of the gem being used?

Gemfile

source :rubygems

gem 'sinatra'
gem 'sinatra-contrib'
gem 'sequel'

gem 'jruby-openssl'
gem 'rack-flash'
gem 'sinbook', git: 'https://github.com/JamesGecko/sinbook'
gem 'sinatra-authentication'

gem 'json-jruby'

gem 'coffee-script'
gem 'therubyrhino'

error

PS C:\users\james\code\portal> jruby -S bundle
Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Fetching https://github.com/JamesGecko/sinbook
Installing addressable (2.2.8)
Installing backports (2.5.1)
Installing bouncy-castle-java (1.5.0146.1)
Installing coffee-script-source (1.3.1)
Installing multi_json (1.2.0)
Installing execjs (1.3.0)
Installing coffee-script (2.2.0)
Installing dm-core (1.2.0)
Installing dm-migrations (1.2.0)
Installing dm-timestamps (1.2.0)
Installing dm-validations (1.2.0)
Installing eventmachine (0.12.10)
Installing jruby-openssl (0.7.7)
Installing json (1.5.0)
Installing json-jruby (1.5.0)
Installing rack (1.4.1)
Installing rack-flash (0.1.2)
Installing rack-protection (1.2.0)
Installing rack-test (0.6.1)
Installing rufus-tokyo (1.0.7)
Installing sequel (3.34.1)
Installing tilt (1.3.3)
Installing sinatra (1.3.2)
Using sinbook (0.1.9.jamesgecko) from https://github.com/JamesGecko/sinbook (at master)
Installing sinatra-authentication (0.4.1)
Installing sinatra-contrib (1.3.1)
Installing therubyrhino (1.73.2)
Using bundler (1.1.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
PS C:\users\james\code\portal> jruby .\app.rb
Gem::LoadError: Could not find sinbook (>= 0) amongst [addressable-2.2.8, backports-2.5.1, bouncy-castle-java-1.5.0146.1, bundler-1.1.4, coffee-script-2.2.0, coffee-script-source-1.3.1, dm-core-1.2.0, dm-migrations-1.2.0, dm-timestamps-1.2.0, dm-validations-1.2.0, eventmachine-0.12.10-java, execjs-1.3.0, jruby-openssl-0.7.7, jruby-win32ole-0.8.5, json-1.5.0-java, json-jruby-1.5.0-java, multi_json-1.2.0, rack-1.4.1, rack-flash-0.1.2, rack-protection-1.2.0, rack-test-0.6.1, rake-0.9.2.2, rufus-tokyo-1.0.7, sequel-3.34.1, sinatra-1.3.2, sinatra-authentication-0.4.1, sinatra-contrib-1.3.1, therubyrhino-1.73.2, tilt-1.3.3]
               to_specs at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/dependency.rb:247
  activate_dependencies at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:777
                   each at org/jruby/RubyArray.java:1611
  activate_dependencies at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:766
               activate at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/specification.rb:750
           try_activate at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems.rb:212
                require at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:59
                require at c:/dev/jruby-1.7.0.preview1/lib/ruby/shared/rubygems/custom_require.rb:55
                 (root) at .\app.rb:7

app.rb

require 'sinatra'
require 'sinatra/reloader'
require 'json'

require 'digest/sha1'
require 'rack-flash'
require 'sinatra-authentication'

use Rack::Session::Cookie, secret: 'foobar'
use Rack::Flash

# ...

解决方案

Add require "bundler/setup" to app.rb. It it needed to load the bundled environment. More info may be found in the bundler documentation.

Since you're using Sinatra, you may also want to look into using config.ru.

这篇关于Gem :: LoadError在Gemfile中使用git repo时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆