运行"捆绑安装"失败并要求我运行"捆绑安装"

Tim*_*Tim 9 ruby install bundle ruby-on-rails rvm

实际上,所有与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.
Run Code Online (Sandbox Code Playgroud)

我以为我已经安装了rails ...(以下命令是从app目录外部运行的):

$ rails -v
Rails 3.0.3

$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
Run Code Online (Sandbox Code Playgroud)

知道怎么了"捆绑安装"告诉我运行"捆绑安装"?


我退出了我的app目录并手动完成了

sudo gem install tzinfo -v 0.3.27
Run Code Online (Sandbox Code Playgroud)

但再次进入我的app目录并尝试"捆绑安装"...

$ bundle install
Could not find polyglot-0.3.1 in any of the sources
Run `bundle install` to install missing gems.
Run Code Online (Sandbox Code Playgroud)

所以我回到了app目录,做了

sudo gem install polyglot -v 0.3.1
Run Code Online (Sandbox Code Playgroud)

"捆绑安装"现在已经产生了

$ bundle install
Could not find treetop-1.4.9 in any of the sources
Run `bundle install` to install missing gems.
Run Code Online (Sandbox Code Playgroud)

为什么我不得不手动安装我过去没有的所有这些随机宝石?(新开发环境).任何人都知道我的环境中可能存在错误吗?

Tim*_*Tim 9

好吧我猜我修好了..

对于bundle install从app目录内部运行时抱怨的gems ,我通过走出app目录并sudo gem install [gem]逐个进行安装.bundle install --gemfile=myApp/Gemfile还做了安装了几个失踪的宝石.

我不知道为什么我无法bundle install从app目录中运行...跛脚.

  • 当您执行“gem install”时,它会将其全局安装到您的 ruby​​ 版本(假设您使用的是 Rbenv),因此“gem list”将显示这些。当您执行 bundle install 时,它会为特定项目安装 gem,在您的项目文件夹中,“bundle show”将显示该项目的 gem。当你有很多项目时,你不想污染你的全局 gem - 它们*应该*(意见,最佳实践)在每个项目的基础上安装。 (2认同)