问题
I just installed RVM, Ruby, Rails etc. on my virtual ubuntu 12.04 32bit running in a virtualbox. Now I encounter the problem that for my first rails project bundle install
or bundle update
takes very long time. Even when I create a new project with rails (which includes bundle install
).
I use only the standard gems:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
I tried bundle install without any gems but gem 'rails', '3.2.12'
. After that I typed again bundle install
with all gems in my gemfile. It took me 10 minutes to check for dependencies. The output of --verbose is a mix of HTTP success
and HTTP redirection
.
Rails version: Rails 3.2.12
Ruby version: ruby 1.9.3p392 (2013-02-22 revision 39386)
Rvm: rvm 1.18.18
bundle version: Bundler version 1.3.2
I already searched fot a solution, but nothing helped.
回答1:
I want to warn: There is a security purpose for using https over http. Try at first the other answers mentioned in this thread.
Changing https
to http
in my Gemfile did the magic. Before I have to create the project with rails new APP --skip-bundle
回答2:
Bundler just got an update of parallel processing of gems.
gem install bundler --pre
will solve the problem in the best possible way for now.
Source
回答3:
Bundler v1.12.x was released in 2016 and caused some users to experience slow bundle install issues.
In this instance staying with v1.11.2 is the best option (it's fast) until a fix is released.
It's worth heading over to Rubygems.org to try different versions of the bundler gem.
Check existing bundler versions, uninstall existing version, install version 1.11.2 example:
gem list | grep bundler
gem uninstall bundler -v existing-version-number
gem install bundler -v 1.11.2
回答4:
You can also use multiple jobs, it may improve a little bit
bundle install --jobs 8
Here is a tutorial about it
回答5:
A developer friendly method is to override the gem server with a faster alternative.
In our case, we can configure http
as a mirror to address slow https
connections:
bundle config mirror.https://rubygems.org http://rubygems.org
This allows you to keep original Gemfile
configuration while still using faster http
connections to fetch gems.
If you wanted to switch back to https
:
bundle config --delete mirror.https://rubygems.org
bundle config
has a default --global
option. You can specify --local
to limit configurations to local application folder.
Configuration is saved into global ~/.bundle/config
and local .bundle/config
.
回答6:
If you're still seeing this issue with Bundler 1.12.5, you may want to try updating the OpenSSL used by your Ruby.
For me this went like so:
pmorse$ bundle --version
Bundler version 1.12.5
pmorse$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.1j 15 Oct 2014
pmorse$ openssl version
OpenSSL 0.9.8zg 14 July 2015
pmorse$ brew info openssl
openssl: stable 1.0.2h (bottled) [keg-only]
[... more brew
output ...]
pmorse$ rvm reinstall ruby-2.2.2 --with-openssl-dir=`brew --prefix openssl`
[... lots of rvm
output ...]
pmorse$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.2h 3 May 2016
This should make bundle
quicker again without requiring you to go from https
to http
.
回答7:
I know this may be basic answer but try to install developer tools from the main Ruby site. I have had a similar problem and it did work. Sometimes simple solutions are the best!
Good luck!
来源:https://stackoverflow.com/questions/15343771/ruby-bundle-install-update-too-slow