Gem Does Nothing - ruby-on-rails

I guess I messed things up a little bit:
I wanted to play around with Ruby on Rails a little bit. I installed it a year ago but never used it. Till now.
Because of some problem a ran into I wanted to start from beginning with a fresh install. I uninstalled the Rails gems (3.0.7 and 3.1.1) and followed this guide for a fresh install: http://eddorre.com/posts/rails-ultimate-install-guide-on-os-x-snow-leopard-using-rvm-homebrew-and-passenger
But now gem does nothing - when I type gem install bundle in my terminal the cursor goes straight to the next line. Even gem list or gem --help doesn't work. I get no error messages.
I have no clue what happened. Some thoughts?

I'll do a full reinstall of rvm:
rvm implode
and start again:
bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)
If you try to recover the existing environment, there are some options to rvm that can be useful:
debug - show info plus additional information for common issues
upgrade - Lets you upgrade from one version of a ruby to another,
including
migrating your gemsets semi-automatically.
cleanup - Lets you remove stale source folders / archives and
other miscellaneous
data associated with rvm. repair - Lets you repair parts of your environment e.g. wrappers, env files and
and similar files (e.g. general maintenance).

Since you're trying to start over anyway, I would highly recommend that you use RVM. Do the "single user install" and these gem problems should disappear entirely. Then if you get a specific error message, post that so we have something to go on.

Please run this command in your console:
gem env
This command will return your gem environment, and one more correction: I guess it should be 'gem install bundler' not 'gem install bundle'.

Related

Not able to view site in browser with railsinstaller due to missing Gem

I am super, super new at programming and I have been trying to get everything set-up on my computer. I have installed RailsInstaller, go to >railsinstaller_demo, and type in rails s. I get the following error though could not find gem 'uglifier <>= 1.0.3> x86-mingw32'
I looked through the forum and found how to do a gem list and i noticed it was not there. I then went to gembundler and ran $ gem install bundler. I tried again but it did not work.
I am sure the answer is on this site, but i am so new that i see all these lines of code I actually have no idea where to type it in.. I am running Windows 7.
thanks for taking the time to help out a real beginner.
Have you gone to the $ railsinstaller_demo directory and run the bundle install command? This will install the gem dependencies for the application; you will not be able to run the server until you've bundled the gems. Additionally, if you're still having issues with the uglifier gem, go ahead and remove the line in the Gemfile and then run bundle install
If you need further help with the Command Prompt, you an find out more at http://bit.ly/ZajVeW.
Thanks,
Evan

Missing Gemfiles in Rails Install

Bit of a strange question, but here goes.
I'm a relative beginner to rails, and I've just started working on my second app locally. However, after each install I'm getting the following problem - that several gemfiles are missing (railties being the most obvious).
So, I deleted the install, re-ran it and listed the gemfiles - they are all there. However, after initializing a git repo and pushing the project up to my GitHub a gem list command shows that a number of gems are now missing - at this point I can't run any rake commands or for example rails server.
So I cleared the repo and re-installed. gem list says the gems are all present, server and rake commands work; but push the repo and it subsequently packs up - gem list shows only a handful of gems remain.
Bearing in mind my experience, I'm prepared to believe I'm missing something very obvious, but any advice would be appreciated.
welcome ;-)
I suppose you want to create a Rails 3 application. So first make sure you have installed bundler.
gem install bundler
The steps for creating the application are:
rails new your_app
Then run bundler in the applications folder:
cd your_app
bundler install
Now you should be able to run the application:
rails s
Go and visit localhost:3000. If that does not work, you have other problems. Paste the stack trace then ...
The problem was I forgot that I had two versions of Ruby installed and I had not properly set a default with rvm for some reason. Specifying the default then checking the gems were present for that version of Ruby fixed it.

While installing rake 0.8.7 for Rails on a new computer, I get "unable to convert "\xFC" from ASCII-8BIT to UTF-8"

What does this mean? Is my system set for UTF when it should be ASCII or something?
This problem has been nagging me on one of my machines for the past year, and I only solved it just now. The machine in question is an old ASUS laptop running 32-bit Ubuntu 12.04, Ruby 1.9.3, and RVM. I had the same problem running gem update, but only with rake 0.8.7
Sadly, I'm a bit of a newb at this stuff, so I can't quite work it all out, but I ran into two separate issues - inability to update rake beyond 0.8.7, and inability to get the documentation to process correctly. The second problem is the more difficult to understand, but, as I understand it, it results from one particular version of rdoc relying on SourceIndex, which was deprecated in November, 2011.
Both problems are gem-related - character sets in the OS, to name one potential cause, don't seem to be an issue. As best as I can tell, my version of the problem was that my paths weren't correctly set to update the gem program. I'd type "gem update --system" from the prompt and gem would tell me that it was up-to-date, but rake wouldn't update and the characters wouldn't be correctly installed in the documentation for rake, either.
In retrospect, what apparently happened was that the path was set up so that gem update would affect a different version of Ruby than the one I was using under RVM. So, the key is to update the gems you're using by running the update program without having to rely on the path.
The solution has four parts. The first is to uninstall rake.
The second is to update the gems (this also makes it possible to update rake). Usually, this can be done by just typing gem update --system Since I'm using RVM, I did this by going into ~/.rvm/gems/ruby-1.9.3-p194/bin and ran update_rubygems. I suspect that my system fell out of configuration between the path and multiple versions of Ruby. By going directly to the ~/.rvm/gems/ruby-1.9.3-p194/bin directory and running the update_rubygems command,the system was able to update both the correct rdoc gem so it correctly translated the characters, and the correct rake gem, both of which are gems in the rvm-managed version of Ruby.
The third stage is to reinstall rake.
The fourth is the usual suite of testing and hygiene commands - gem clean, gem update, gem list, etc.
I regret not having a better handle on this, but hope this helps.

How to reinstall Ruby and Gem on Mac OS X

I am trying very hard to uninstall Ruby and Gem from my computer so that I can do a complete reinstall of all, since I've clogged up a few errors and crossed wires.
When I do sudo uninstall gem I get the following progress/message:
Preparing Uninstall...
Uninstall Began...
Uninstall Failed...
Reason: ErrorMissingBundle
I'm NOT, I repeat NOT at this point looking to install rvm, since I just want to clean out my computer and get rid of the bugs before I install anything else.
You didn't say how far you had gotten in the process, but all you have to do is remove the Ruby directory (grep for it) and the gems will go away with it. You'll probably have to update your paths as well.
But, you really should use RVM. If you install it correctly those errors you see will not affect you because you will be using the RVM installed Ruby and gems. Also, the system installed Ruby is sometimes used in apps and if you remove it you could break those apps.
More information in this previous question.

Uninstalling rails and gems, getting error "cannot uninstall, check 'gem list -d ...'

I'm going to start with the usual noob line, "I'm new to rails". Oh, and I'm running Mac OSX 10.6.4
I've been following a bunch of guides to get set up, specifically these two here and here. The guides are great, the reason I'm using the second one is because of RVM and the reason I'm using the first is for MYSQL.
Anyway, when I started, I wasn't following the directions completely and so after I installed RVM, for some reason I installed rails with sudo gem install rails -v 2.3.8 because thats the version I need. So... I realized I was using the system ruby, and wasn't taking advantage of RVM. What I did now was install Ruby 1.9.2 so I can install rails 3 and test it out, and I also installed 1.8.7 and rails 2.3.8 so I can use it for what I need it.
Now, I'm trying to uninstall the gems from the system Ruby, but whenever I try to I'm getting this error:
ERROR: While executing gem ...
(Gem::InstallError)
cannot uninstall, check 'gem list -d
whatever gem I try to uninstall'
Any ideas on how to remove rails and all these gems? I just want to start from scratch with RVM.
UPDATE:
By running the command gem list -d rails I've located the gems in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/18. Should I delete them manually?
SOLUTION!! I still don't understand why this happened, I'd love if someone could explain. Why was the path non-existant? What caused this error?
Also, I want to mention that the solution I linked to has a comment saying that the question is a duplicate. However, the original has a different solution and did not help me (though its the basis to finding this answer). Simply deleting the gems manually in finder would not remove them from the gem list.
Without further ado - it turns out that when trying to uninstall the gem, it can't locate its path (I think the problem is because of installing with sudo, but I might be wrong). What you need to do is (you have to do this one by one for each gem, or at least I had to):
gem list -d 'name of gem' and note the "Installed at:" location (in my case, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8)
sudo gem uninstall 'name of gem' -i 'the path noted above' (ex. in my case, sudo gem uninstall rails -i /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Some gems still might not uninstall returning a permissions error. If this is the case, what you need to do is create a folder /bin, in the path above. (in my case, mkdir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin
Continue uninstalling as in step 2, still using the original path (/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8).
Now all uninstalls should work!
Two things you should note when using rvm:
You should NEVER use sudo to install gems, just do a gem install xxx
You can not uninstall gems installed in the global gemset from within another gemset. You should switch to the global gemset and uninstall from there:
rvm gemset use global
gem uninstall xxx
execute this either in irb or in a script proper:
`gem list --no-versions`.split("\n").each do |gem|
`gem list -d #{gem}`.gsub(/Installed at(.*):.*/).each do |dir|
dir = dir.gsub(/Installed at(.*): /,'').gsub("\n", '')
system "gem uninstall #{gem} -aIx -i #{dir}"
end
end
try this way :
sudo apt purge rails
ok i see....
at this point, if you're in the terminal, it shouldn't take but a few minutes to reinstall the whole shebang
I suspect you might not be in the correct rvm name that has the gems you're trying to install so thats why i'd suggest reinstalling rubygems and building you're core gems from the beginning in your Global rvm gemset name.
A more generic answer to delete all gems for older versions of gem 1.8.
gem list --no-versions | xargs sudo gem uninstall -aIx
I was using RVM to manage my gemsets and had not selected the gemset. I wasn't that I had selected the wrong gemset, it was that I hadn't selected the gemset at all. A lovely way to spend the bulk of an hour of my first morning back after my summer holidays!

Resources