[英]Rails: gem file/ bundle install with gem 'bootstrap-sass'
我將這一行添加到了gem文件中:
gem 'bootstrap-sass' '3.3.2.0'
然后我得到:
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'bootstrap-sass3.3.2.0 (>= 0) ruby' in the gems available on this machine.
所以我從rubygems.org下載並安裝了它:
$ gem install bootstrap-sass -v 3.3.2.0
Fetching: autoprefixer-rails-5.1.11.gem (100%)
Successfully installed autoprefixer-rails-5.1.11
Fetching: bootstrap-sass-3.3.2.0.gem (100%)
Successfully installed bootstrap-sass-3.3.2.0
2 gems installed
然后嘗試:
$bundle install
or/and
$bundle update
仍然得到消息:
Could not find gem 'bootstrap-sass3.3.2.0 (>= 0) ruby' in the gems available on this machine.
我該怎么辦?
如果要安裝特定版本的gem,則必須在gem和version(或其他任何參數,可選)之間輸入逗號。 喜歡,
gem 'bootstrap-sass','3.3.2.0'
但是,如果您只想安裝沒有任何版本的gem,則只需要提供gem文件名即可
喜歡,
gem 'bootstrap-sass'
上面聲明gem的好處是它是獨立於版本的,因為bundle installer會自動為我們的項目下載最新版本的gem。
在下面的代碼中,您可以看到我使用的Rails版本為4.2.1,並且用逗號分隔,但是對於其他的gem我沒有提到任何版本。 因此,捆綁安裝程序將自動為您的Rails項目安裝最新版本。
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.