Installing Rails - It says I didn't even though I did - ruby-on-rails

I am trying to run a
rails new demo
But am told:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
I run that command, and many 'fetching' lines followed by many 'Installing RDoc documentation for...' are run, but then the last lines say:
Installing RDoc documentation for rails-3.2.13...
file 'lib' not found
and then it stops running, and the 'rails' command (see above) doesn't work still. Why is Rails not installed? What else should I do? Thanks

Looks like this is rdoc related. Short version, try :
gem install rdoc
And then launch the install of rails again.
Look at this answer that seems to have helper a lot of people with this exact problem.

I solved it: apparently I was trying to install rails in the directory. I did the following and it worked well:
cd /
Then I ran
sudo gem install rails
Then I cd into the relevant directory again and now
rails new demo
worked!

It's not a good idea to do a 'sudo gem install rails' since you may experience permission problems with your applications in the future.
I would recommend you using RVM which is a ruby version manager. You can easily install different versions of Rubies, you can create application specific gemset's and minimize possible futuristic 'rails is not currently installed' errors.
I highly recommend you searching and reading about these concepts:
RVM
Gemsets
.rvmrc
.bashrc and .bash_profile

Related

railsinstaller.org website was not found, what do I do now?

I'm taking a course on Ruby on Rails. In the video the instructor recommends that you use
railsinstaller.org to download Rails instead of rubyonrails.org . But the site isn't there.
According to whois, it is inactive.
(When I investigated I got farther, but then got SSL errors. See solution below.)
My instructor said to go to this website for instructions. This solution also works if you are getting SSL errors when trying to use Ruby On Rails ( See Note1 and Note2 below first):
https://www.youtube.com/watch?v=iF8caVyDi5g&list=PLCC34OHNcOtrk3BDsfZwf4GattdLoKCOF&index=1&t=839s
Note1:
... get installer from here (If you have Git already, unclick that box.):
https://web.archive.org/web/20210306035811/http://railsinstaller.org/en
The idea is to remove ruby and rails from your machine. (Make sure you have node and yarn.) Run the installer. Then install newest stable versions of Ruby and Rails. Installing Ruby from rubyinstaller.org
Note2: Instead of using "gem install rails" command as Youtube video says, Do the following:
(thanks to Kingston Peng for this process)
"Run the command:
$ gem install gemName --source http://rubygems.org
it worked for me. I got: "1 gem installed".
So I tried:
$ gem install rails --source http://rubygems.org
", said Kingston Peng.
It worked! "37 gems installed"!
The GoRails setup guide is a good resource for this. This will show you how to download the latest versions of Ruby and Rails.
I'm working on the same course by the same instructor. Also, railsinstaller.org isn't working, so, you may use the link mentioned below to directly install the same version of ruby rails.
https://s3.amazonaws.com/railsinstaller/Windows/railsinstaller-3.4.0.exe

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.
`

Rails version stuck at 2.3.5 how to update to 3.x

Hi there thanks for looking into this.
after a clean install of Linux ubuntu 10.10 i tried to re-install rails.
after doing sudo gem install rails, I can see I am returned version 3.2.3 of rails
But after generating a new project i couldn't find my gemfile so i tried ruby -v which returns 2.3.4 wich is odd since I know I got the latest.
Also when trying sudo gem update --system I get an error because I might override system files. any solution here?
I'd recommend using rvm to manage your ruby sets -- as well as defining gemsets for each project that will allow you to make sure each project has just the gems it needs.
Here's a link to the rvm installation instructions (they should work with ubuntu):
https://rvm.io/rvm/install/
Here's some info on basic use of gemsets with rvm:
https://rvm.io/gemsets/basics/
Also, when using rails 3+, you should make a practice of typing bundle exec rails -v -- that way you'll use the gems defined for the project you're in.
Can you try typing bundle exec rails -v and letting us know what you see?

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!

Problem installing LESS for Ruby on Rails - script/plugin: command not found

I am trying to install LESS in a Ruby on Rails project. I am able to run the gem successfully, but when I try to install the plugin for LESS, I get an error. Here's what shows in the terminal:
MacBook:benji jesse$ sudo gem install less
Successfully installed less-1.2.21
1 gem installed
Installing ri documentation for less-1.2.21...
Installing RDoc documentation for less-1.2.21...
MacBook:benji jesse$ sudo script/plugin install git://github.com/cloudhead/more.git
sudo: script/plugin: command not found
I am a .NET developer trying to learn Ruby on Rails (on a Mac), so I am new to all this stuff.
My question's are:
Is the script/plugin command a standard command?
What does it do?
Where can I learn more about this command?
Why does it say command
can't be found?
Is the script/plugin command a standard command?
It is in rails 2, it has changed in rails 3:
rails plugin
# or
script/rails plugin
What does it do?
installs the given plugin into the RAILS_ROOT/vendor/plugin, but you should look if there is a gem version of the plugin, than you can add a gem dependency to this gem.
Where can I learn more about this command?
run the command without any parameters
Why does it say command can't be found?
try ls script/ and see if the file exists.
You have to be in the application directory. Say you created your rails app in the folder development/rails_app. You must execute the script/plugin command from there (and you don't need super user permissions for that):
cd development/rails_app
script/plugin install git://github.com/cloudhead/more.git
The plugin installation will apply only to the current rails application (in this case, rails_app). So if you create another application, you must run the script/plugin command again.

Resources