Ruby-on-rails 运行“捆绑安装”失败并要求我运行“捆绑安装”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6971290/
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
Running "bundle install" fails and asks me to run "bundle install"
提问by Tim
In fact, all gem-related commands result in the same error message, when run from inside the existing rails app I cloned from a git repo.
事实上,所有与 gem 相关的命令都会导致相同的错误消息,当从我从 git repo 克隆的现有 Rails 应用程序内部运行时。
$ bundle install
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.
$ gem list
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.
$ bundle update
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.
$ rails -v
Could not find tzinfo-0.3.27 in any of the sources
Run `bundle install` to install missing gems.
I thought I already had rails installed... (following commands were run from outside the app directory):
我以为我已经安装了 rails...(以下命令是从 app 目录之外运行的):
$ rails -v
Rails 3.0.3
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
Any idea what's up with "bundle install" telling me to run "bundle install"??
知道“捆绑安装”是怎么回事告诉我运行“捆绑安装”吗?
I exited my app directory and manually did
我退出了我的应用程序目录并手动执行
sudo gem install tzinfo -v 0.3.27
But upon entering my app directory again and trying "bundle install"...
但是在再次进入我的应用程序目录并尝试“捆绑安装”时...
$ bundle install
Could not find polyglot-0.3.1 in any of the sources
Run `bundle install` to install missing gems.
So I went back out of the app directory, did
所以我回到了应用程序目录之外
sudo gem install polyglot -v 0.3.1
"bundle install" now yielded
“捆绑安装”现在产生了
$ bundle install
Could not find treetop-1.4.9 in any of the sources
Run `bundle install` to install missing gems.
Why am I having to manually install all these random gems that I didn't have to in the past? (new dev env). Anyone know what I could have set up wrong in my environment?
为什么我必须手动安装所有这些过去不需要的随机 gem?(新的开发环境)。任何人都知道我可能在我的环境中设置错误吗?
采纳答案by Tim
OK guess I fixed it..
好吧,我想我修好了..
For the gems that running bundle installcomplained about when run from inside the app directory, I installed them by going outside the app directory and doing sudo gem install [gem]one by one. Doing bundle install --gemfile=myApp/Gemfilealso installed a couple of the missing gems.
对于在bundle installapp 目录内运行时会报错的 gem ,我是通过跑到 app 目录外sudo gem install [gem]一一安装的。Doingbundle install --gemfile=myApp/Gemfile还安装了几个缺失的 gem。
I have no idea why I wasn't able to just run bundle installfrom inside the app directory...lame.
我不知道为什么我不能bundle install从应用程序目录中运行...跛脚。
回答by Stiege
I had this problem. Once I did:
我有这个问题。一旦我做了:
[root@smaug ~]# PATH=$PATH:~/.gem/ruby/2.0.0/bin
[root@smaug ~]# PATH=$PATH:~/.gem/ruby/2.0.0/bin
[root@smaug ~]# export PATH
[root@smaug ~]# export PATH
Then it was fixed and I could just
然后它被修复了,我可以
[root@smaug msf3]# bundle install
[root@smaug msf3]# bundle install
successfully.
成功地。
回答by wizbcn
The problem is that all your commands have actually prepended bundle exec. If you take a look at the output it is bundler telling you your gems are not installed. This can happen if you have some plugin in rbenv installed like rbenv-bundle-exec, rbenv-bundler or rbenv-binstubs.
At least for me, it was happening the first time you try to bundle installin a project, because it actually detects there is a Gemfilein the current folder and tries to do bundle exec bundle installwhich obviously won't work.
问题是您的所有命令实际上都在bundle exec. 如果你看一下输出,它是 bundler 告诉你你的 gems 没有安装。如果您在 rbenv 中安装了一些插件,例如 rbenv-bundle-exec、rbenv-bundler 或 rbenv-binstubs,就会发生这种情况。至少对我而言,这是您第一次尝试bundle install在项目中尝试时发生的情况,因为它实际上检测到Gemfile当前文件夹中有一个,并尝试执行bundle exec bundle install显然行不通的操作。
You can use the solution of Tim, and run bundle install from outside the project folder.
您可以使用 Tim 的解决方案,并从项目文件夹外部运行 bundle install。
You can disable or uninstall temporally the extension that is prepending bundle execto ruby commands.
您可以暂时禁用或卸载bundle execruby 命令前面的扩展。
Or if the problem is happening because you use rbenv-bundle-exec, just do:
或者,如果问题是因为您使用 rbenv-bundle-exec 而发生的,请执行以下操作:
NO_BUNDLE_EXEC=1 bundle install
NO_BUNDLE_EXEC=1 bundle install
回答by Ajay Vijayasarathy
Installing ruby from rubyinstaller
从rubyinstaller安装 ruby
and then gem install bundlefixed the issue for me on a win 10 PC.
然后gem install bundle在 win 10 PC 上为我解决了这个问题。
回答by user3636139
I had a very similar issue, after trying many different things I finally found a simple solution that worked...I restarted my computer (mac os 10.9x). No joke.
我有一个非常相似的问题,在尝试了许多不同的事情之后,我终于找到了一个简单的解决方案……我重新启动了我的电脑(mac os 10.9x)。不是开玩笑。

