簡體   English   中英

在Rails 3的本地gem(凍結寶石)的“捆綁安裝”中,不斷獲取“Source不包含任何版本的......”?

[英]In Rails 3's “bundle install” of local gem (frozen gem), keep getting “Source does not contain any versions of …”?

我使用的是gem vendor/gems/some-api-0.1.0 ,從另一個項目復制,並添加到Gemfile

gem 'some-api', :path => '~/development/myproj/vendor/gems/some-api-0.1.0'

但如果我執行以下操作,它將失敗並顯示以下消息:

$ bundle install
Fetching source index for http://rubygems.org/
Could not find gem 'some-api (>= 0)' in source at ~/development/myproj/vendor/gems/some-api-0.1.0.
Source does not contain any versions of 'some-api (>= 0)'

在網上搜索似乎建議需要gemspec? 所以我需要在.gemspec寫一個.gemspec ,是真的嗎? 有人可以說明在這種情況下如何做到這一點?

stackoverflow上有許多其他類似的帖子,但萬一有人偶然發現這篇文章:

出於某種原因,當您嘗試從本地源使用gem時,您需要准確指定您正在使用的gem版本,例如

gem 'some-api', '0.2.0', :path => '~/development/myproj/vendor/gems/some-api-0.1.0'

只是聲稱在路徑中有一個寶石並不意味着那里有一顆寶石。 Gems有gemspec文件描述gem的名稱,gem所屬的文件以及各種其他信息。

如果some-api-0.1.0應該在:path目錄中包含一個名為some-api.gemspec的文件,它應該包含有關gem的信息,Bundler可以使用它來從:path中獲取gem。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM