在 Ruby on Rails 新项目中运行 bundle install
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7438809/
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
run bundle install in Ruby on Rails new project
提问by Leahcim
I'm learning Ruby on Rails with Lynda.com. In one of the early videos, the instructor creates a new project using the command
我正在通过 Lynda.com 学习 Ruby on Rails。在早期的视频之一中,讲师使用命令创建了一个新项目
rails new simple_cms -d mysql
After he ran that, he got some output like this, which I also got, but at the bottom of mine, I saw "run bundle install". His doesn't have that...
在他运行之后,他得到了一些这样的输出,我也得到了,但在我的底部,我看到了“运行捆绑安装”。他的没有那个...
Is that a command I'm supposed to run?
这是我应该运行的命令吗?
create test/unit
create test/unit/.gitkeep
create test/performance/browsing_test.rb
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
回答by MrDanA
You firstneed to install the bundler gem:
您首先需要安装 bundler gem:
gem install bundler
Once it's done, run:
完成后,运行:
bundle
or:
或者:
bundle install
(same thing)
(一样)
回答by Alex
Bundleris a gem dependency manager. It ensures that all the gems you use (chunks of third party code) have their dependencies (other gems that they rely on) satisfied.
Bundler是一个 gem 依赖管理器。它确保您使用的所有 gem(第三方代码块)都满足它们的依赖项(它们依赖的其他 gem)。
You should run bundle install, as this installs all the gems Rails will need to get going.
您应该运行bundle install,因为这会安装 Rails运行所需的所有 gem。
The video you're watching probably concerns an old version of Rails. The current version (by that I mean version 3 and above) uses Bundler by default. Versions lower than 3 did not ship with Bundler support.
您正在观看的视频可能与旧版 Rails 相关。当前版本(我的意思是版本 3 及更高版本)默认使用 Bundler。低于 3 的版本不提供 Bundler 支持。
The fantastic Ryan Bateshas a bit more on Bundler, and loads of stuffon Rails 3.
出色的Ryan Bates在 Bundler 上有更多内容,在 Rails 3 上有很多东西。
回答by Excalibur
This issue caught me off guard. However, I was ultimately at fault. I had created a shell alias of rails="bundle exec rails"And I had forgotten about this, as it served to make working with my other projects easier. However, the "rails new" command is incompatible with such an alias. D'oh.
这个问题让我措手不及。然而,最终还是我错了。我创建了一个 shell 别名rails="bundle exec rails"并且我忘记了这一点,因为它使我的其他项目的工作更容易。但是,“rails new”命令与这样的别名不兼容。哦。
回答by Nesha Zoric
To make this work, you have to run gem install bundlerfirst. This will install your bundler, that you need to install gems with bundle install. More info about this topic here.
要使其工作,您必须先运行gem install bundler。这将安装您的捆绑器,您需要使用bundle install. 有关此主题的更多信息,请点击此处。

