开发者

How to make "bundle install" run faster

开发者 https://www.devze.com 2023-02-15 05:00 出处:网络
When I need to add a new dependent gem in the Gemfile, then run \"bundle install\" it seems to take forever (sometimes 7 minutes for me).How can I make this process faster?

When I need to add a new dependent gem in the Gemfile, then run "bundle install" it seems to take forever (sometimes 7 minutes for me). How can I make this process faster?

I did a search on the web, and it mentioned a Gemfile.lock file. That is appearing for me in my local directory. But running "bundle install" still takes forever.

I've been learning Ruby on Rails for the past 2 weeks (so forgive the newby question, if the answer i开发者_高级运维s obvious).


It sounds like they have made some changes in bundler 1.1 that are going to give some speed improvements so I would start by trying that:

mike@sleepycat:~$ sudo gem install bundler --prerelease
Fetching: bundler-1.1.pre.1.gem (100%)
Successfully installed bundler-1.1.pre.1
1 gem installed


This is "normal" behavior and is a pretty common complaint. Thoughtbot recently wrote a blog post that detailed the issue and has some suggestions on how to speed things up.

http://robots.thoughtbot.com/post/2729333530/fetching-source-index-for-http-rubygems-org


From inside of your local directory, try

bundle config jobs 7

This will make bundle fetch jobs in parallel. 7 because I have 8 cpu cores. Generally, it should be one less than number of cpu cores you have.

This is supported from Bundler 1.4.0 onwards


You can cache gems so bundler will not spend extra time for further checks during install/update

$ bundle package --no-prune --all
0

精彩评论

暂无评论...
验证码 换一张
取 消