简体   繁体   中英

Error while installing ruby on rails,Failed to build gem native extension

I am getting the following error while trying to install the rails in my linux mint:

sudo gem install rails
Fetching: activesupport-4.2.3.gem (100%)
Successfully installed activesupport-4.2.3
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby2.2 -r ./siteconf20150718-15613-1wed0b4.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 /var/lib/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /var/lib/gems/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out

This is my ruby version:

 shafaet@shafaet-HP-ProBook ~ $ ruby -version ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux-gnu] -e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError) 

Any help would be greatly appreciated, thanks.

I believe there is no ruby development environment installed. Development env is needed to compile ruby extensions. You can run the following command:

sudo apt-get install ruby2.2-dev # as you're using the 2.2 version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM