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.
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 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
I have been installing Ruby on Rails based on the instruction from edX online class.
Here is a list of terminal commands, and, where relevant, corresponding output:
$ sudo apt-get install ruby1.9.1
installation successful
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
$ tar zxvf ruby-1.8.24.tgz
$ cd ruby-1..8.24
$ sudo ruby setup.rb
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
* 1 bug fix:
* Install the .pem files properly. Fixes #320
* Remove OpenSSL dependency from the http code path
------------------------------------------------------------------------------
RubyGems installed the following executables:
/usr/bin/gem1.9.1
Up to here, everything looked fine, but the I tried to install rails and failed:
$ sudo gem install rails
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.8.gem (100%)
Fetching: builder-3.0.3.gem (100%)
Fetching: activemodel-3.2.8.gem (100%)
Fetching: rack-1.4.1.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.1.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.1.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.8.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.33.gem (100%)
Fetching: activerecord-3.2.8.gem (100%)
Fetching: activeresource-3.2.8.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.8.gem (100%)
Fetching: rake-0.9.2.2.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: thor-0.16.0.gem (100%)
Fetching: json-1.7.5.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:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
mkmf is part of the ruby1.9.1-dev package. This package contains the header files needed for extension libraries for Ruby 1.9.1. You need to install the ruby1.9.1-dev package by doing:
sudo apt-get install ruby1.9.1-dev
Then you can install Rails as per normal.
Generally it's easier to just do:
sudo apt-get install ruby-dev
The suggested answer only works for certain versions of ruby. Some commenters suggest using ruby-dev; that didn't work for me either.
sudo apt-get install ruby-all-dev
worked for me.
sudo apt-get install ruby-dev
worked for me
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.