我将这一行添加到了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.
我该怎么办?
答案 0 :(得分:5)
您忘记了gem name和version之间的逗号。
if (in != null) {
StringBuffer stringBuffer = new StringBuffer();
final char[] charBuffer = new char[8 * 1024];
reader = new BufferedReader(new InputStreamReader(in), charBuffer.length);
int read;
while ((read = reader.read(charBuffer)) != -1) {
stringBuffer.append(charBuffer, 0, read);
}
PrintWriter out = new PrintWriter(new FileWriter(cacheFile.getAbsolutePath()));
out.print(stringBuffer.toString());
out.flush();
out.close();
reader.close();
Gson g = new Gson();
Article article = g.fromJson(stringBuffer.toString(), Article.class);
}
请参阅documentation,您需要指定由gem 'bootstrap-sass', '3.3.2.0'
分隔的可选参数。
答案 1 :(得分:3)
如果要安装任何具有特定版本的gem,则必须在gem和version(或其他任何可选参数)之间使用逗号。 喜欢,
gem 'bootstrap-sass','3.3.2.0'
但是如果你只想安装没有任何版本的gem,你需要只提供gem文件名,那就够了
等
gem 'bootstrap-sass'
以上声明gem的好处是它与版本无关,因为bundle安装程序会为我们的项目自动下载最新版本的gem。
在下面的代码中你可以看到我使用了带有4.2.1版本的Rails,并用逗号分隔,但是对于更多的宝石,我没有提到任何版本。 所以捆绑安装程序会自动为你安装最新版本的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'