Why Bundle Install is installing gems in vendor/bundle?

后端 未结 6 1817
我寻月下人不归
我寻月下人不归 2020-12-24 04:46

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

app_dir/vendor/bundle

path and consumes loads of disk space. I a

相关标签:
6条回答
  • 2020-12-24 05:09

    To Install Gem in system wide avoiding path vendor/bundle, just run the following command in project directory

    bundle install --system
    
    0 讨论(0)
  • 2020-12-24 05:11

    Try running bundle env. This will tell you where the path configuration is set.

    0 讨论(0)
  • 2020-12-24 05:14

    First of all, acording to your info, it seems that you have installed both rvm and rbenv. Thats a very bad idea. You have to delete one of them (rbenv + bundler works like a charm for me, didnt try rvm).

    In regard to your question check .bundle/config in your project, as all the configuration for bundle to that project lies there (if its still deleted, you can create a new one). You migh want to add this line (or change it, if its already there): BUNDLE_DISABLE_SHARED_GEMS: '0' for sharing gems, they go where your BUNDLE_PATH: is set (BUNDLE_PATH: vendor in my case).

    For the global configuration file look in ~/.bundle/config

    Also this man page could be of use: bundle config

    0 讨论(0)
  • 2020-12-24 05:16
    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

    0 讨论(0)
  • 2020-12-24 05:23

    Try installing using

    bundle install --system
    

    I think initially the bundle install was run with --path flag and bundler now rememebers that confguration.

    From the bundler man page

    Some options are remembered between calls to bundle install, and by the Bundler runtime.

    Subsequent calls to bundle install will install gems to the directory originally passed to --path. The Bundler runtime will look for gems in that location. You can revert this option by running bundle install --system.

    EDIT: As mentioned in comments below, and also otherwise, this installs the gems system wide. In case you are using rvm etc to manage your environment for different apps, check @IuriG's answer mentioned above.

    0 讨论(0)
  • 2020-12-24 05:34

    In your project folder you will have .bundle directory that holds configuration for bundler. try deleting that folder. it should reset the install path for your gems back to system-wide settings.

    In the case you just want to edit the install path, opening .bundle/config with your favorite editor should show you the path to vendor/bundle. Removing that line will restore it to defaults without removing other configs you might have.

    Also, another less frequent scenario is your system-wide settings being messed up. According to @NaoiseGolden:

    I had to delete .bundle from my Home folder (rm -rf ~/.bundle). You can check out your configuration running bundle env

    0 讨论(0)
提交回复
热议问题