Can't boot WEBrick, the folder for Rails gem is empty - ruby-on-rails

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.

Related

I'm having trouble installing rails 4.2.6

I've gone through hours of tutorials and stackoverflow articles and still haven't found a solution.
Ruby is installed and it works fine.
I ran the command gem install rails and it went through the gem installation process; I watched as my C:\ruby\lib\ruby\gems\2.4.0\gems directory was updated with rails dependencies. The funny thing is I don't actually see a gem called rails? I only see rails-dom-testing-2.0.3 and rails-html-sanitizer-1.0.3
I close the terminal and reopened and it doesn't recognize the rails command at all.
I checked that my PATH c:/ruby/bin matched the executable directory listed in the command gem environment.
Still no dice.
Anyone have any suggestions?
The problem was with msys/mingw, I didn't have them installed so rails was failing to install.

Can I downgrade from rails 5 to rails 4.2.5 on Ubuntu VPS

Ok this may sound stupid, but I was setting up a VPS to deploy an rails app to... the app is built with rails 4.2.5.
On the server I accidentally installed rails -v 5. And after deploying the app to the server I always get this error: We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly. when I try to visit the site.
Since this is a Rails error I figured that it is due to the mismatched versions of (rails 4.2.5) at my computer and (rails 5) on the server side.
So my question is if it's possible to uninstall rails 5 and install 4.2.5 instead on the VPS server?
EDIT
Rails 5 was installed gem install railsand then rbenv rehash
Because I'm new to this all and the learning curve is steep I feel safer asking here instead of messing it up by my self :)
Since you installed rails using gem install rails, you can run gem uninstall railsand then gem install rails -v 4.2.5.
I recommend you to use a Gemfile. In it you can specify the version of the gems that you want to use and bundle install will handle the installation.

Why does this happen when i try to update rails to 4.0.0?

I pulled someone's project from github, and we seem to be using different rails versions. When i update the rails gem, it seems to go fine, but when i check the version it still shows the previous one and won't run the rails server.
me#ubuntu:~/Documents/RailsProjects/vega$ gem install rails
--version=4.0.0
Successfully installed rails-4.0.0
Parsing documentation for rails-4.0.0
Done installing documentation for rails after 0 seconds
1 gem installed
me#ubuntu:~/Documents/RailsProjects/vega$ rails -v
Rails 3.2.6
You have multiple Rails versions installed and it's reporting the first one it finds.
Does the project have a gemfile? If so just let bundle handle this for you:
bundle install
bundle exec rails s

Update rails app to ruby 2.0.0 bundler error

I started a Heroku Rails app using Ruby 1.9.3 and Rails 4.0.1.
I decided soon after to update my ruby version to 2.0.0 as this apparently works better with Rails 4.0.1. So, I installed the ruby2.0 package using apt-get and other associated packages, then I set ruby 2.0.0 as the default using sudo ruby-switch --set ruby2.0, finally I updated the Gemfile in my app, changing the line ruby '1.9.3' to ruby '2.0.0' Now, when I run bundle install I am presented with this error, and I don't know why...
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
Following this heroku guide didn't seem to help... I set the path to what is shown there and it didn't seem change anything. Maybe I am being stupid and there is something in that path that I need to replace something with information specific to my machine? I feel like the part where I set vendor/bundle/ruby/2.0.0/bin should have some specific info, like changing "vendor" to something but I don't know what... I'm not totally familiar with this stuff yet, this is my first time using heroku and ruby.
EDIT: I forgot to mention (in case it is important) I am running Xubuntu 13.10.
I believe I have fixed the issue. I was somehow running the bundle command which was installed for ruby 1.9.3... so when it compared the gemfile definition with the version it was running on they mismatched. Re-rerunning sudo gem install bundler has sorted it out.

Can't get rails debug to work in aptana 3 in Ubuntu

Before i get into whats wrong, I have tried tutorials and looked at stackoverflow questions, including this one, so I don't think this is a duplicate answer.
I am using Aptana 3.0.4, Rails 3.14, and ruby 1.9.2.
I can start the server normally just fine through aptana or the command line. When i try to run in debug mode i get this: http://i.imgur.com/vYKuY.jpg
However, i have installed the ruby-debug-ide gem, have it listed in my gem file, and bundle installed. I have also tried using ruby-debug19 and ruby-debug-ide19 (bundle installed after trying each gem).
gem environment is the correct path to where my gems are installed. ruby-debug-ide and all the others are located in that path.
I am not sure what I am doing wrong. Please help.

Resources