2
votes

I am taking the App Academy Open course and have come to an issue with a project. I am trying to install the Gems needed to use RSPEC but am getting an error when installing the bundler.

Here is my attempt to install.

mkremeier@DESKTOP-QTDVHIG:/mnt/c/Users/micha/OneDrive/Documents/Code/rspec_exercise_1$ bundle install

Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Using bundler 2.1.4 Following files may not be writable, so sudo is needed: /usr/local/bin /var/lib/gems/2.5.0 /var/lib/gems/2.5.0/build_info /var/lib/gems/2.5.0/cache /var/lib/gems/2.5.0/doc /var/lib/gems/2.5.0/extensions /var/lib/gems/2.5.0/gems /var/lib/gems/2.5.0/specifications Fetching byebug 11.1.3

Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run:

  bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo.

Password: Installing byebug 11.1.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /tmp/bundler20200521-509-1g7fh3zbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug

/usr/bin/ruby2.5 -r ./siteconf20200521-509-1opspqa.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20200521-509-1g7fh3zbyebug-11.1.3/gems/byebug-11.1.3 for inspection. Results logged to /tmp/bundler20200521-509-1g7fh3zbyebug-11.1.3/extensions/x86_64-linux/2.5.0/byebug-11.1.3/gem_make.out

An error occurred while installing byebug (11.1.3), and Bundler cannot continue. Make sure that gem install byebug -v '11.1.3' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile: byebug

2

2 Answers

2
votes

After doing some more digging I found the solution was running

sudo aptAinstall ruby-dev

then running

bundle install 
0
votes

can't find header files for ruby at /usr/lib/ruby/include/ruby.h

It seems that you're missing some necessary header files there, you can check the ByeBug documentation to find out which ones are needed.

Are you on Linux or macOS?