为什么捆绑安装是在供应商/捆绑软件中安装宝石? [英] Why Bundle Install is installing gems in vendor/bundle?

查看:66
本文介绍了为什么捆绑安装是在供应商/捆绑软件中安装宝石?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我做 bundle install 所有宝石都会安装在

  app_dir / vendor / bundle 

路径并消耗大量磁盘空间。我也尝试安装宝石,它应该得到安装,即通过这样的开发gemsets:

  bundle install --no-deployement 

但这不适用于我,并在 vendor / bundle code>。我如何使它能够在全球范围内为所有应用程序或红宝石宝石位置安装?我也尝试删除 .bundle / config ,但没有任何更改。



我正在使用:

  rvm版本:1.23.14 
ruby​​版本:2.0.0-p247
rails 3.2.13

这里是我的〜/ .bash_profile

  export PATH = / usr / local / bin:/ usr / bin:/ bin:/ usr / sbin:/ sbin:/ usr / local / bin 
eval$(rbenv init - )
alias pg ='pg_ctl -D / usr / local / var / postgres -l /usr/local/var/postgres/server.log'

[[-s$ HOME / .rvm / scripts / rvm]]&& amp ;源代码$ HOME / .rvm / scripts / rvm#将RVM加载到shell会话中*作为函数*
[[-s$ HOME / .rvm / scripts / rvm]]&& 。 $ HOME / .rvm / scripts / rvm#Load RVM function

My 〜/ .bashrc

  PATH = $ PATH:$ HOME / .rvm / bin#将RVM添加到PATH脚本中

您可能需要的其他信息:

  aman @ Amandeeps-MacBook-Pro〜/ Projects / qe(开发)* $捆绑
/Users/aman/.rvm/gems/ ruby-2.0.0-p247@global/bin/bundle

aman @ Amandeeps-MacBook-Pro〜/ Projects / qe(develop)* $ rbenv捆绑
/ Users / aman / .rbenv / versions / 2.0.0-p247 / bin / bundle

amandeep @ Amandeeps-MacBook-Pro〜/ Projects / qe(develop)* $ rbenv ruby​​
/ Users / aman /.rbenv/versions/2.0.0-p247/bin/ruby

aman @ Amandeeps-MacBook-Pro〜/ Projects / qe(develop)* $ rbenv gemset active
rbenv:NO这样的命令`gemset'

aman @ Amandeeps-MacBook-Pro〜/ Projects / qe(develop)* $ which rails
/Users/aman/.rvm/gems/ruby-2.0。 0-p247 @ global / bin / rails

我尝试过这也没有帮助:

  bundle install --system 

并删除 .bundle 目录。



请帮助我在gemsets中安装gem而不是 vendor / bundle 或者默认的地方。

解决方案<使用 bundle env 查看路径和包配置


$
$ $ 〜/ .rvm / gems / ruby​​-2.0.0-p247 b $ b

  bundle install --path〜/ .rvm / gems / ruby​​-2.0.0-p247 

这是全球性的,您也可以使用您自己的自定义路径。 发布这个 bundle install 永远不需要路径目录下(〜/ .rvm / gems / ruby​​-2.0.0-p247,在我的情况下为) in app_folder / vendor / bundle



Whenever I do bundle install all of the gems get installed at

app_dir/vendor/bundle

path and consumes loads of disk space. I also tried installing gems where it should get installed i.e gemsets while development by this:

bundle install --no-deployement

but this isn't working for me and installeing gems at vendor/bundle. How can I make it to be installed globally for all applications or in ruby gemsets location ? I also tried removing .bundle/config but nothing changed.

I am using:

rvm version: 1.23.14
ruby version: 2.0.0-p247
rails 3.2.13

Here is my ~/.bash_profile:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
eval "$(rbenv init -)"
alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log'

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

My ~/.bashrc:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

Some other information that you might need:

aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ which bundle
/Users/aman/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle

aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ rbenv which bundle
/Users/aman/.rbenv/versions/2.0.0-p247/bin/bundle

amandeep@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ rbenv which ruby
/Users/aman/.rbenv/versions/2.0.0-p247/bin/ruby

aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ rbenv gemset active
rbenv: NO such command `gemset'

aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ which rails
/Users/aman/.rvm/gems/ruby-2.0.0-p247@global/bin/rails

I tried this also but didn't helped:

bundle install --system

and removing .bundle directory.

Please help me in installing gems in gemsets not vendor/bundle or a default place.

解决方案

  1. Use bundle env to view paths and bundle configuration

  2. After this set bundle path to ~/.rvm/gems/ruby-2.0.0-p247 like this:

    bundle install --path ~/.rvm/gems/ruby-2.0.0-p247
    

    which is global and also you can use your own custom path.

  3. Post this bundle install will never need path again and will always install all of your gems in that directory(~/.rvm/gems/ruby-2.0.0-p247 in my case) for that app not in app_folder/vendor/bundle

这篇关于为什么捆绑安装是在供应商/捆绑软件中安装宝石?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆