1

I have often seen that bundle install will try to build a gem but gem install fetches the same gem from remote repository. I thought bundler would also try to fetch the gems. Can anyone explain the difference? For example, if my Gemfile lists libv8, bundle install fails with the following error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 
....
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.

But, gem install succeeds by just fetching it. man bundle-install has this to say:

If this is the first time you run bundle install (and a Gemfile.lock does not exist), bundler will fetch all remote sources, resolve dependencies and install all needed gems.

Why does bundle install decide to build the gem while gem install just installs it? Also, it may build for some version but just install it for some other version of the same gem? For example, thrift-0.9.0.1.patched is built but thrift-0.9.2.0 is installed on my machine. Why the difference?

341008
  • 9,862
  • 11
  • 52
  • 84
  • Are you sure the same gem version for libv8 is what's installed locally? Bundler resolves gem dependencies, so Bundler may be trying to install a version of the libv8 gem that's different from what the gem install command tries. Where's the rest of the error output for why Bundler couldn't install the gem? – SnakeWasTheNameTheyGaveMe Dec 21 '14 at 21:06
  • Bundler tries to install v3.16.14.3 which is what gem install installs. The error is due to compiler mismatch when trying to build native code (C++). – 341008 Dec 22 '14 at 02:42
  • Not sure if this helps or not, but install nodejs; in your Gemfile if you have therubyracer, comment that out. See if that works (based off of an answer: http://stackoverflow.com/a/24720497/191741) – SnakeWasTheNameTheyGaveMe Dec 23 '14 at 16:43

0 Answers0