jalen201
jalen201

Reputation: 303

Could not find gem 'rails' when trying to access database

Im getting the following error message when i do

rails db:schema:dump or any rails command in this directory

Could not find gem 'rails (~> 5.0.1) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

i tried bundle install and received the following error message

>C:\Users\jalen\Documents\Sites\simple_cms>gem install rails -v 5.0.1
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

   > current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1/ext/nio4r
C:/Ruby23/bin/ruby.exe -r ./siteconf20161220-8320-1xbe7zi.rb extconf.rb
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

>Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby23/bin/$(RUBY_BASE_NAME)
>C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
>You have to install development tools first.
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in >postpone'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
        from extconf.rb:3:in `<main>'

>To see why this extension failed to compile, please check the mkmf.log which can be found here:

  >C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r->1.2.1/mkmf.log

>extconf failed, exit code 1

>Gem files will remain installed in C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1 for inspection.
Results logged to C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r-1.2.1/gem_make.out

I thought i may be DevKit that was the problem, but I've already installed DevKit on my computer, and when in another directory i can see that i have

rails -v
Rails 5.0.1

Upvotes: 2

Views: 107

Answers (1)

jalen201
jalen201

Reputation: 303

I figured out the answer. Make sure that if you download the x64 ruby version, you also download the x64 DevKit installation as well. I didnt pay attention to that and downloaded a x64 with a non x64.

Upvotes: 1

Related Questions