ERROR: Failed to build gem native extension

I was trying to install ruby gem for nats, and I got this error:

[ec2-user@ip-xx-xx-xx-xx nats]$ sudo gem install nats
Building native extensions. This could take a while…
ERROR: Error installing nats:
ERROR: Failed to build gem native extension.

current directory: /usr/local/share/ruby/gems/2.0/gems/eventmachine-1.2.3/ext
/usr/bin/ruby2.0 -r ./siteconf20170630-22515-1601fpy.rb extconf.rb
mkmf.rb can’t find header files for ruby at /usr/share/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/ruby/gems/2.0/gems/eventmachine-1.2.3 for inspection.
Results logged to /usr/local/lib64/ruby/gems/2.0/gems/eventmachine-1.2.3/gem_make.out

To fix this, run this command:
sudo yum -y install ruby-devel gcc

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s