Ruby-on-rails 如何在捆绑包中添加 gem

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8984948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 02:41:02  来源:igfitidea点击:

how to a add gem in the bundle

ruby-on-rails

提问by karnhick

ERROR: paperclip is not part of the bundle. Add it to Gemfile. (Gem::LoadError)

错误:回形针不是捆绑包的一部分。将其添加到 Gemfile。(宝石::加载错误)

to add paperclip gem in bundle list i tried the following

要在捆绑列表中添加回形针宝石,我尝试了以下操作

bundle install paperclip

捆绑安装回形针

but yet again error occurs that is:

但再次发生错误,即:

Your bundle is complete! It was installed into ./paperclip The path argument to bundle install is deprecated. It will be removed in versi on 1.1. Please use bundle install --path paperclip instead.

您的捆绑包已完成!它被安装到 ./paperclip 不推荐使用 bundle install 的路径参数。它将在 1.1 版中删除。请改用 bundle install --path 回形针。

kindly assist me.

请帮助我。

回答by John Douthat

Open Gemfilein your favorite text editor. Add the line gem 'paperclip'. Then run bundle install

Gemfile在您喜欢的文本编辑器中打开。添加行gem 'paperclip'。然后运行bundle install

回答by senya

Another way to add a gem to the bundle is to run:

将 gem 添加到包中的另一种方法是运行:

bundle add paperclip

The bundle addcommand seems to be supported since Bundler v1.15.

bundle add从 Bundler v1.15 开始似乎支持该命令。

When you run bundle add, the requested gem is added to the Gemfile and the bundle installis being executed automatically so you don't have to run it yourself.

当您运行时bundle add,请求的 gem 会添加到 Gemfile 中,并且bundle install会自动执行,因此您不必自己运行它。