Ask Your Question

rails from package management cannot create new project (F21 and F22 Beta)

asked 2015-05-25 10:27:27 -0500

Martin Ueding gravatar image

updated 2015-05-27 02:52:58 -0500

FranciscoD_ gravatar image

My webhoster supports Python, but only as scripts, now with Django. Since I am tired of PHP, I would like to try something new. The hoster offers Rails, so I thought about giving Ruby and Rails a shot. From the long term Debian Ruby packager I read that the Ruby community prefers using gem over the package management system of the distributions.

I still tried to install rubygem-rails and then performed rails new blog as given in the tutorial. This did not work on either version of Fedora that I have in virtual machines. On Fedora 21 (hostname martin-konik) the end of the error is this:

         run  bundle install
Fetching gem metadata from
Fetching additional metadata from
Resolving dependencies...
Installing rake 10.4.2
Installing i18n 0.7.0

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

    /usr/bin/ruby extconf.rb 
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /home/mu/.gem/ruby/gems/json-1.8.2 for inspection.
Results logged to /home/mu/.gem/ruby/extensions/x86_64-linux/json-1.8.2/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.
         run  bundle exec spring binstub --all
/usr/share/gems/gems/bundler-1.7.6/lib/bundler/friendly_errors.rb:10:in `rescue in with_friendly_errors': uninitialized constant Thor::AmbiguousTaskError (NameError)
        from /usr/share/gems/gems/bundler-1.7.6/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
        from /usr/share/gems/gems/bundler-1.7.6/bin/bundle:18:in `<main>'
bundler: command not found: spring
Install missing gem executables with `bundle install`

Then on Fedora 22 Beta, I had some load errors, whatever that might be:

LoadError: no such file to load -- thread_safe/jruby_cache_backend
     ThreadSafe at /usr/share/gems/gems/thread_safe-0.3.4/lib/thread_safe/cache.rb:12
         (root) at /usr/share/gems/gems/thread_safe-0.3.4/lib/thread_safe/cache.rb:3
         (root) at /usr/share/gems/gems/activesupport-4.2.0/lib/active_support/inflector/inflections.rb:1
    Inflections at /usr/share/gems/gems/activesupport-4.2.0/lib/active_support/inflector/inflections.rb:28
      Inflector at /usr/share/gems/gems/activesupport-4.2.0/lib/active_support/inflector/inflections.rb:27
  ActiveSupport at /usr/share/gems/gems/activesupport-4.2.0/lib/active_support/inflector/inflections.rb:6
        require at org/jruby/
         (root) at /usr/share/gems/gems/activesupport-4.2.0/lib/active_support/inflector/inflections.rb:5
         (root) at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:1
        require at org/jruby/
        require at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54
         (root) at /usr/share/gems/gems/activesupport-4.2.0/lib/active_support/inflections.rb:1
        require at org/jruby/
         (root) at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:1
        require at /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:54
        require at org/jruby/ ...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-05-25 16:52:46 -0500

aeperezt gravatar image

Hi here is what you need:

sudo yum install ruby-devel mariadb-devel

there maybe some other devel package you may need but will depend of what gems are you going to use, also make sure you have make and gcc installed.

edit flag offensive delete link more


Shoudn't those then be dependencies of the respective packages that I have installed?

Martin Ueding gravatar imageMartin Ueding ( 2015-05-26 04:05:09 -0500 )edit

No those are developer packages containing files that are needed only at build time, musto the file are header files (ruby.h) usually found in /usr/include.

aeperezt gravatar imageaeperezt ( 2015-05-26 09:24:51 -0500 )edit

You need header files for compiling C extensions of the gems, but the ones in the Rails stack are packaged and therefore you don't need them unless you need to install new gems from the internet.

jstribny gravatar imagejstribny ( 2015-06-01 03:33:01 -0500 )edit

answered 2015-06-01 03:38:15 -0500

Rails packager here. We do package all dependencies, but Bundler will still try to fetch the newest ones. The solution is to skip the bundle by running rails new app --skip-bundle. You can then create a Gemfile.lock file with bundle --local. That will succeed only if you install the other packages as well:

dnf install rubygem-{rails,sqlite3,coffee-rails,sass-rails,uglifier,jquery-rails,turbolinks,jbuilder,therubyracer,sdoc,spring,byebug,web-console}

If you need a newer version of any component, you need to lock the packaged versions yourself and then you can run bundle command as normal. Also note that on Fedora 22 dnf sometimes installs JRuby instead of MRI. Unfortunately JRuby is not ready yet to be used on Fedora so in that case install ruby package yourself.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-05-25 10:27:27 -0500

Seen: 725 times

Last updated: Jun 01 '15