Restarting Rails for terminal session - ruby-on-rails

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.

Related

Rails initialization checksum error

I'm trying to initialize a new rails app on windows, and running rails new <appname> generates everything up to vendor/assets/stylesheets/.keep, but when bundle install is run, rails generates this error:
Checksum of /versions does not match the checksum provided by server! Something is wrong.
I'm not sure what's causing this, as I've done nothing to rails itself. Any help is appreciated.
Edit: If it's an error caused by windows being finicky, I have the option of moving to Linux, but I'd like to know what's wrong first.
I had the same issue using windows, and was able to solve it by uninstalling bundler and installing an older version.
rails new <appname>
gem uninstall bundler
gem install bundler -v 1.9
cd <appname>
bundle install
That did it for me!
In my case there was a *.pre.1 version and I chose to uninstall that particular version and then "bundle install" worked.
Try removing your ruby cache folder and then try again. So for example if you are on Linux machine and you are using rbenv and say ruby 2.1.5 folder. Your path would be similar to something like (Not sure where on windows ruby is stored):
~/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/
Removing this folder and trying bundle install again should resolve the issue.
It will be great, if you move to a Linux machine.
On windows it's a hell to pay in my 5 years of experience what i have learned is not to mess with (ror) or (rs) in windows. here's a cheeky thing you can do an easy way. I believe you are using github as repo, as a editor you are using sublime if thats is a case open your gemfile you will see check the image or
try to clear cache on your server or update the gems.
I had this same exact error and solved it the following way. I think you are missing the ruby DevKit being installed.
Go here http://rubyinstaller.org/downloads/ and download/install the latest 32-bit Ruby version (as of writing this 2.2.4, you will need it for the web-console gem)
Make sure to add your ruby\bin folder to your environmental path variable
The trick is hidden near the bottom-left of the same page under the "Development Kit" section. You need to download and extract the right one into a permanent location (as of writing this for 32-bit - DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)
After extracting the files, go into the main directory and run "ruby dk.rb init" followed by "ruby dk.rb install" (More information can be found here
That fixed it for me and i can now fully install with no checksum issues
This problem began when i tried to run my app. I wrote rails s and the console said me Could not find sdoc-0.4.1 in any of the sources Run bundle install to install missing gems. Then i wrote bundle install and the message that appeared was Checksum of /versions does not match the checksum provided by server! Something is wrong.
I solve this problem following this steps:
Wrote bundle install
The console said me Could not find sdoc-0.4.1 in any of the sources
Then i reinstalled this gem with gem install sdoc -v 0.4.1
I tried again to write rails s and it's was solved.
`

Could not find RubyGem rails - Rails Server error

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

Installing Gitlab 6-1 on Cent OS 6

I'm following this recipe:
https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md
Step Initialize Database and Activate Advanced Features:
bundle exec rake gitlab:setup RAILS_ENV=production
I can't pass that step, tried several ways of getting to work, create a specific gemset, used the default, and I'm still getting the error as it couldn't find any gem, first it asks for Rake, but it's installed. Tried (without bundle exec) rake gitlab:setup RAILS_ENV=production and he asked for another gem, installed the one asked and it asks for another. Tried bundle install, which give me some curious thing, every time I tried it installed all the gems, it didn't show "using gem X (x.x.x)" was "installing gem X (x.x.x)" always.
I'm hoping for someone who passed for such problem installing Gitlab on production and could give me some light how to solve this.
I'm using Ruby 2.0.0. RVM. Cent OS 6.2. Gitlabhq 6-1 branch.

RailsInstaller not completing install on OS X 10.6, not responding

I'm new to Ruby on Rails and to web development in general. Yesterday I successfully installed Git, osx-gcc-installer, RVM and Ruby on my Mac OS X 10.6. To try to get Rails and everything else I need, I downloaded RailsInstaller for OS X 10.6 and apparently made it at least through the unpacking of files, but now I have the RailsInstaller Setup window hanging on my machine for over two hours. It has a message "Completing the RailsInstaller setup wizard"... "Setup has finished installing Railsinstaller on your computer." Clicking on Finish, Back, anything does absolutely nothing; the window just sits there. Clearly something is not working, and I'm not sure what to do. I checked the Rails install in the terminal and got the following message:
$ rails --help
/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:inactivate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
I'm hesitant to start killing processes or restart my machine. Also wondering if I'm going to have to purge everything I've already installed and start over from scratch, and not sure how I would go about that.
Any thoughts would be appreciated. Thanks.
I had trouble running the installer as well. It was not exactly the same issues you had.
Running the installer from the terminal as root worked much better for me.
The command would look something like this:
sudo ./RailsInstaller-1.0.4-osx-10.7.app/Contents/MacOS/osx-intel --mode text
If that does not work, you can get additional debugging diagnostics with the --debuglevel flag.

rails -v errors when setting up rvm

I am trying to set up an environment as per this tutorial http://railstutorial.org/book#sec:1.2.2.3 however I get the below error when running 'rails -v'
bash-3.2$ rails -v
/Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:219:in `activate'
from /Users/sandbox1/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:1065:in `gem'
from /usr/bin/rails:18:in `<main>'
Has anyone had this before?
Incase anyone else has this problem and the marked answer doesn't solve it, here is what fixed it for me:
Don't use sudo.
"When you do sudo you are running
commands as root, another user in
another shell and hence all of the
setup that RVM has done for you is
ignored while the command runs under
sudo (such things as GEM_HOME,
etc...). So to reiterate, as soon as
you 'sudo' you are running as the
root system user which will clear out
your environment as well as any files
it creates are not able to be
modified by your user and will result
in strange things happening. (You
will start to think that someone has
a voodoo doll of your
application...)"
Taken from here
resolved by running "rvm gemset update"

Resources