I am trying to install rails on my EC2 instance. I installed gem after reinstalling ruby. I am running ruby version 1.8.7 and gem version 1.8.12. I am trying to install rails and getting the following error.
*$ sudo gem install rails -v=3.1.1 Fetching: activesupport-3.1.1.gem (100%) Fetching: activemodel-3.1.1.gem (100%) Fetching: actionpack-3.1.1.gem (100%) Fetching: activerecord-3.1.1.gem (100%) Fetching: activeresource-3.1.1.gem (100%) Fetching: actionmailer-3.1.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing rails: ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.6.4 for inspection. Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.6.4/ext/json/ext/parser/gem_make.out*
Any ideas?
Thanks!
I've had a similar error when trying to install rails. The issue was that I had not installed the ruby-devel.i686 bundle. Granted this is on CentOS 6.3, but it seems like you may need to install this as well.
Related
newbee here. Hope you can help me with this.
rails -v
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install railsYou can then rerun your "rails" command.
KrisOrqla:~ Kris$ sudo gem install rails
Password:
Failed to load /Users/Kris/.gemrc because it doesn't contain valid YAML hash
Fetching: minitest-5.4.2.gem (100%)
Successfully installed minitest-5.4.2
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: activesupport-4.1.6.gem (100%)
Successfully installed activesupport-4.1.6
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: actionview-4.1.6.gem (100%)
Successfully installed actionview-4.1.6
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: actionpack-4.1.6.gem (100%)
Successfully installed actionpack-4.1.6
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://api.rubygems.org/gems/tilt-1.4.1.gem) ( ITS SAYS ERROR)
I type rails -v again but the problem occured!
Thanks
Your rails gem not installed properly yet. While we install rails gem first all the dependency gems installed then rails install. Rails dependency gem tilt not installed properly here. try run sudo gem install tilt -v='1.4.1' separately then again run sudo gem install rails. then check rails gem present in your gem list.
i already solved this problem. Ruby and Rails were successfully installed. I just followed these two for instructions. (http://installrails.com/steps/choose_os) and (http://docs.railsbridge.org/installfest/osx_rvm?back=macintosh%23step2-1)
I try to install rails with command gem install rails --no-ri --no-rdoc and then error occur.Below is output of error
gem install rails --no-ri --no-rdoc
Fetching: multi_json-1.7.8.gem (100%)
Successfully installed multi_json-1.7.8
Fetching: tzinfo-0.3.37.gem (100%)
Successfully installed tzinfo-0.3.37
Fetching: atomic-1.1.12.gem (100%)
Building native extensions. This could take a while...
Successfully installed atomic-1.1.12
Fetching: thread_safe-0.1.2.gem (100%)
Successfully installed thread_safe-0.1.2
Fetching: activesupport-4.0.0.gem (100%)
Successfully installed activesupport-4.0.0
Fetching: builder-3.1.4.gem (100%)
Successfully installed builder-3.1.4
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://rubygems.org/gems/rack-test-0.6.2.gem)
What should i do to solve this problem?
It looks like your source either isn't responding properly or the gem can't be found at the source.
Try gem install rack-test. If that gives you an error try switching the source you're getting the gem from.
First add the source
gem source -a 'https://production.cf.rubygems.org'
Then try installing again.
OR
You could try installing directly from a different source with
gem install rack-test --source 'https://production.cf.rubygems.org'
Once you get that gem to install properly, try installing rails again.
I have a very old rails app (rails 2.3.10 and ruby 1.8.7) and we want to move it on another server.
I can reinstall all gems with same version except for paperclip 2.7.
when i tried to install it i receive an error on activesupport, that it seems it require ruby 1.9.3. According with paperclip doc this shouldn't happens, some one of you can help me?
i tried with all gems except paperclip, with no gems, and installing an old version of activesupport. Below you can find my tests.
app#new-server:/home/app/current# sudo gem list
*** LOCAL GEMS ***
app#new-server:/home/app/current# sudo gem install paperclip -v=2.7.0
Fetching: i18n-0.6.4.gem (100%)
Successfully installed i18n-0.6.4
Fetching: multi_json-1.7.7.gem (100%)
Successfully installed multi_json-1.7.7
Fetching: tzinfo-0.3.37.gem (100%)
Successfully installed tzinfo-0.3.37
Fetching: minitest-4.7.5.gem (100%)
Successfully installed minitest-4.7.5
Fetching: atomic-1.1.10.gem (100%)
Building native extensions. This could take a while...
Successfully installed atomic-1.1.10
Fetching: thread_safe-0.1.0.gem (100%)
Successfully installed thread_safe-0.1.0
ERROR: Error installing paperclip:
activesupport requires Ruby version >= 1.9.3.
I also tried to install activesupport 2.3.10 (that according with paperclip doc match requirements but i receive the same error
"activesupport requires Ruby version >= 1.9.3."
regards
Mauro
You will have to build the gem manually and use the file from the pull request here: https://github.com/thoughtbot/paperclip/pull/1270. - Ralph
I'm just learning how to use Ruby on Rails and everything was fine.
But today, as I tried to use the command rails new foo or even rails -v it gave me this:
C:\Users\Me\Ruby>rails new demo_app C:/Program Files
(x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in `r
eport_activate_error': Could not find RubyGem railties (>= 0)
(Gem::LoadError)
from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems .rb:244:in
`activate_dep'
from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems
.rb:236:in
activate'
from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems .rb:1307:ingem'
from C:/Ruby193/bin/rails:22:in `'
So... whats going wrong?
gem list rails gave me this:
C:\Users\Me\Ruby>gem list rails
*** LOCAL GEMS ***
I'm using Windows 7 and have no rvm or pik, but it worked fine the last 5 days.
Okay, i tried to install rails new with 'gem install rails'
and it said this:
C:\Users\Me\Ruby>gem install rails
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.5.0.gem (100%)
Fetching: activesupport-3.2.11.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.11.gem (100%)
Fetching: rack-1.4.5.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.2.2.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.11.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.35.gem (100%)
Fetching: activerecord-3.2.11.gem (100%)
Fetching: activeresource-3.2.11.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.12.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.11.gem (100%)
Fetching: rack-ssl-1.3.3.gem (100%)
Fetching: json-1.7.6.gem (100%)
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Well... i already installed DevKit 5 days ago, but i did it again, this time starting the command line as Admin.
Then i 'tried' to install json:
C:\Users\Me\DevKit>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
"C:/Program Files (x86)/ruby-1.9.2/bin/ruby.exe" extconf.rb
creating Makefile
make
Makefile:160: warning: overriding commands for target `C:/Program'
Makefile:153: warning: ignoring old commands for target `C:/Program'
Makefile:160: warning: overriding commands for target `Files'
Makefile:153: warning: ignoring old commands for target `Files'
C:/Program Files (x86)/ruby-1.9.2/bin/ruby -e "puts 'EXPORTS', 'Init_generator'"
> generator-i386-mingw32.def
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `C:/Program Files (x86)/ruby-1.9.2/bin/ruby -e "puts 'EXPOR
TS', 'Init_generator'" > generator-i386-mingw32.def'
make: *** [generator-i386-mingw32.def] Error 2
Gem files will remain installed in C:/Program Files (x86)/ruby-1.9.2/lib/ruby/ge
ms/1.9.1/gems/json-1.7.6 for inspection.
Results logged to C:/Program Files (x86)/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/jso
n-1.7.6/ext/json/ext/generator/gem_make.out
And i got this-.-
Im really a beginner in this, so i dont know anything else i could try.
You probably messed up your ruby/rails installation at some point.
I highly recommend using RailsInstaller which takes care of installing Ruby, Rails and all the gotchas (DevKit etc) for you, in one click.
Of course you should uninstall everything first.
Well now, i just reinstalled everything, but before doing that i realized that i was in the windows command line. With the git bash i had no problems (ok, not the same, thats why i reinstalled the whole thing). And now everything works fine again.
I am using Rails 2.3.14 problem is i want to update rails version to 3.2.x
1. sudo gem update rails
-Updating installed gems
-Nothing to update
2.when i used sudo apt-get update rails
-The update command takes no arguments
3.when i tried to install Rails sudo gem install rails --version=3.2.3
-Fetching: activesupport-3.2.3.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.3.gem (100%)
Fetching: rack-1.4.4.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: actionpack-3.2.3.gem (100%)
Fetching: activerecord-3.2.3.gem (100%)
Fetching: activeresource-3.2.3.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.3.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from extconf.rb:1:in `'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
Can anybody suggest me how can i overcome this issue.
first install
sudo aptitude install ruby1.9.1-dev
will solve your problem