I'm new to rails/ruby and I'm following a tutorial on how to create your first app using git and heroku!
After figuring out the sqlite3 debacle, the error I receive now comes every time I try to start a server.
rails server
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
This error is a pain in the arse, and I don't know how to get around it. There's several articles on here about this particular error, but no one mentions receiving this error while trying to launch the server.
Is there anybody out there that could walk me through the steps to take to remedy this.
Should I provide my gemfile
Should I also provide my database.yml file for reviewing
Logs, anything else I'm not mentioning that could be of help to figure out the source of this problem
Let me know, I'm trying to move forward ad don't want to be stuck at this particular error for days.
First you should install rvm: https://rvm.io/rvm/install then you should install ruby =< 1.9.3
rvm install 2.1
then you should install rails
rvm use 2.1 && gem install rails
then
cd PROJECT_PATH && rails server
everything should work fine
Related
I'm following Michael Hartl's Ruby on Rails tutorial, and I got stuck at trying to start rails server on my Windows 7 machine.
I'm trying to do this by following instructions in Chapter 1.2.5., i.e. by typing
rails server
However, instead of booting WEBrick, this returns the instructions for usage of 'rails' command. I've been googling this for a while, and some of the answers seem to have implied that something is wrong with the rails gem.
Now, I've found the rails gem folder ("C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\rails-3.2.3"), and it's empty!
Also when I try
rails -v
it returns "Rails 3.2.16", although I've removed this version of the gem; if I try
gem list
it kept telling me that the version is 3.2.3.
This persisted until I deleted railties version 3.2.16, which resulted in
rails -v
returning 'Rails 3.2.3', but I still can't boot WEBrick.
Any help would be appreciated.
Did you run the installer?
At the time of this writing, I recommend using the Ruby 2.0.0-p353.
http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct
Save yourself some future gem headaches and install the DevKit too.
http://rubyinstaller.org/downloads/
It should create a folder at C:\Ruby200. Start a new command prompt for the new paths to take affect.
Once Ruby is install, gem install Rails. From your other post, I recommend gem install rails -v 3.2.16
Then execute rails new project_name, then cd project_name. Then run rake db:migrate to create the initial database. At this point, you should be able to run rails server and visit localhost:3000 in your browser.
OK, I've managed to solve my problem.
I've seen a few more people having the same issue, but none of the solutions that I've found helped me, so here's what did it for me, though I'm not 100% sure what exactly was that one thing that actually did it...
I've followed the advice #scarver2 gave in response to my other question, and uninstalled both Rails and Railties gems from my crispy fresh installation of Ruby 1.9.3. (I've installed it using RailsInstaller). Then I've installed Rails 3.2.16 gem by typing
gem install rails -v 3.2.16
and this also installed the corresponding Railties 3.2.16 gem without my intervention.
Then I followed steps from chapters 1.2.3. and 1.2.5. of the tutorial, but making sure that line referencing ruby version in my Gemfile actually corresponds to the version of Ruby that I have installed.
I typed
ruby -v
in the console, to make sure that I have version 1.9.3. indeed. Confirming this, I've edited the Gemfile in my app so it says
ruby '1.9.3'
instead of ruby '2.0.0' line that's used in Listing 1.5. of the tutorial.
After that I've simply went to my app folder, and typed
bundle update
bundle install
in the console, and this time it did not return any errors as it did in my previous attempts. After that, typing
rails server
did what it should have, and my WEBrick server booted, allowing me to access my app on localhost. Yay!
Now, what I think may have gone wrong the last time was either me screwing up the Gemfile, so the gem versions and their dependencies got messed up. I also assume that ineptly trying to fix this by installing and uninstalling different versions of various gems did not quite help. What may have helped was uninstalling Rails and Railties gems, and installing Rails gem again.
I just installed rails on my mac. However when I create a directory for application, I get the following error.
:~ shankey$ rails tickets
/Users/shankey/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Shankey Could not find 'railties' (>= 0) among 8 total gem(s) (Gem::LoadError)
from /Users/shankey/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/shankey/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/shankey/.rvm/rubies/ruby-2.0.0-p0/bin/rails:22:in `<main>'
I am new to rails, excuse me if I am missing something obvious.
Thanks in anticipation.
verify if ruby is currently installed, by typing the following command
$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
you should get similar output. Once, you have verified that ruby is correctly install. then install rails, by folllowing command
$ gem install rails
this command will take a while, once gem installation completes. you can create new app & try to run the server doing the by following
$ rails new demo_app
$ cd demo_app
$ rails server
if you have done everything correctly, you should see that famous "riding on rails" welcome page. Lastly, in case you get any errors. Just post again with error message.
I was doing the Ruby on Rails tutorial by Martl and closed my terminal on my Mac. I had reached Chapter 10 without a problem. When I opened another terminal nothing is working. When I run bundle install I get the following error message:
/Library/Ruby/Site/1.8/rubygems/dependency.rb:247:in to_specs': Could not find bundler (>= 0) amongst [rake-0.8.7, rake-0.8.7] (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:256:into_spec'
from /Library/Ruby/Site/1.8/rubygems.rb:1182:in `gem'
from /usr/bin/bundle:18
How do I get my terminal back to where it was?
Sounds like your RVM environment is not being loaded when you restart your terminal. The Ruby On Rails tutorial glosses over RVM installation rather quickly and thats why this step often gets missed.
Check out the RVM installation guide here in particular Section 2 which describes how to ensure the RVM commands go into your .bash_profile.
Let me know if you need further help.
I'm looking for a solid walkthrough or some direction on getting ferret set up on my rails server. Everyone on the internet makes it seem so easy, but I can't seem to get it all together.
What I've done succesfully:
gem install ferret
gem install acts_as_ferret
No sweat. No errors.
What doesn't work:
Video.find_by_content('test')
-----No Method Error
or
ActsAsFerret.find('test', 'my_index')
I get console to recognize the constant "ActsAsFerret"(only when I install the plugin from https://github.com/jkraemer/acts_as_ferret), but find() returns a No Method Error.
Update: Installing the plugin like this also prevents Mongrel from starting
I AM running in development mode, but configured ferret_server.yml to know what's up.
So does any one have any suggestions? And has anyone had more luck using acts_as_ferret as a gem or as a plugin? Googling gets me small scraps and parts of tutorials that don't seem to fit together, so I hereby vow to blog a solution to this when I figure it out.
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
rails (3.0.3)
P.S. I also ran
sudo apt-get install ferret
on someone's suggestion... still no luck. I'm not even sure if that'd be a reasonable solution for deploying.
have you added
gem 'ferret'
gem 'acts_as_ferret'
in your Gemfile and run
bundle install
?
you can use find_with_ferret method
I am very new to Ruby on Rails. I installed ruby on rails on my Windows 7 using the installer in http://railsinstaller.org/. I could create a project once and thereafter I was not (I dont know what did I do in between :-( ).
The complete errors messages are :-
On creating a new project :-
c:\Sites>rails new Tickets_Test
E:/Ashish/Ruby192/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Cou
ld not find RubyGem rails (>= 0) (Gem::LoadError)
from E:/Ashish/Ruby192/lib/ruby/1.9.1/rubygems.rb:219:in `activate'
from E:/Ashish/Ruby192/lib/ruby/1.9.1/rubygems.rb:1065:in `gem'
from E:/Ashish/RailsInstaller/Ruby1.8.7/bin/rails:18:in `<main>'
on just getting the version:-
c:\Sites>rails --version
E:/Ashish/Ruby192/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Cou
ld not find RubyGem rails (>= 0) (Gem::LoadError)
from E:/Ashish/Ruby192/lib/ruby/1.9.1/rubygems.rb:219:in `activate'
from E:/Ashish/Ruby192/lib/ruby/1.9.1/rubygems.rb:1065:in `gem'
from E:/Ashish/RailsInstaller/Ruby1.8.7/bin/rails:18:in `<main>'
Any idea why the above is happening?
EDIT
Appearently there are two command prompts :-
Ruby command prompt :-
and
Ruby for rails command prompt (The problem is resolved using this command prompt):-
I was using ruby command prompt. Sounds like a stupid question, however, I am not sure how there are "two" command prompts?
I ran into a similar issues after installing heroku toolbelt. I found that heroku added the second one to my path. I removed it from the path and life seems good again!
You seem to have two Ruby versions in your system, 1.9.1 and 1.8.7. Rails gem seems to be installed only for one of them. I'd suggest you to remove one of these versions, and reinstall Rails.
If you have two Ruby versions in your system, 1.9.1 and 1.8.7, then no need to remove any. You can switch between these two Ruby versions with the help of RVM on OS X and Linux. And for Windows you can use Pik.
For further details, you can go through posts - http://rorguide.blogspot.com/2011/03/pik-rvm-tools-to-manage-multiple-ruby.html
Try using Pik (available at http://github.com) to switch between the two or edit your path to include one but not the other. That's simpler.