ArggBake
ArggBake

Reputation: 101

Bundle install errors and cannot continue, even after installing missing gems

I am working on multiple Ruby on Rails applications and running... MacOS 10.15.7, Ruby 2.6.5, Rails 5.2.3,

In a project app directory I am trying to run a bundle install and get the following error:

An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.

I proceed to install the gem from the specified source and get confirmation of install

Building native extensions. This could take a while...
Successfully installed jaro_winkler-1.5.3
Parsing documentation for jaro_winkler-1.5.3
Done installing documentation for jaro_winkler after 0 seconds
1 gem installed

after running bundle install again, I will get the original error

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210406-62421-10txxc5.rb extconf.rb
creating Makefile

current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR=" clean

current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR="
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h',
needed by `adj_matrix.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3
for inspection.
Results logged to
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/extensions/universal-darwin-19/2.6.0/jaro_winkler-1.5.3/gem_make.out

An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.

The error message above doesn't give me any clear indication of what is happening. Additionally there is no such directory in the location where the message says "results logged to."

This seems to be happening in multiple application directories - but with different affected gems in each directory. They are all similar in that the error reads "make sure gem succeeds before bundling", then the gem install will succeed, and then the following bundle install will fail with the same original message.

Earlier today I did a clean Ruby 2.6.5 install and updated the Xcode CLI via xcode-select --install

If I run gem which jaro_winkler I get

/Users/{username}/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/jaro_winkler-1.5.3/lib/jaro_winkler.rb

Does anyone have any information on what could be causing this? I cannot do any bundle install without this happening. Please let me know if any more information is desired. Thank you!

Upvotes: 2

Views: 3481

Answers (3)

Jayesh
Jayesh

Reputation: 1

Try with this following one.

gem install jaro_winkler -v '1.5.4' --source 'https://rubygems.org/' -- --with-cflags="-Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types"

Upvotes: 0

ArggBake
ArggBake

Reputation: 101

Ended up being an issue with gem install location - export PATH="/usr/local/bin:$PATH" was previously added to my .bash_profile and this was effecting where gems were installed.

Somewhere in the error message /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby is mentioned - this is the "system default" Mac version of Ruby and is not the Ruby version I was intending to use with .rbenv ( 2.6.5 ) and gem installs.

Removing the export mentioned above help resolve the issue.

edit- wording

Upvotes: 0

Kevin Maze
Kevin Maze

Reputation: 156

You mentioned that you are using ruby 2.6.5, but the gem is attempting to be installed in 2.6.0. Check that your Gemfile has the correct Ruby version in it.

When you ran gem which, it looks you are using rbenv. Make sure that you are using the correct Ruby version in there, too. Those rubies get installed in a different directory than xcode's. Sometimes there's a .rbenv file in the dir that will set the version as well.

Just some ideas. Hopefully something sticks.

Upvotes: 1

Related Questions