Need a bit of help with installing Ruby and RoR
I installed everything initially last weekend (15/09/2012) including
Ruby, RoR and RubyMine. I've just opened a Command Prompt on my win 7
64bit box and ran:
$ rails --version
which to my surprise returned 2.3.14 as I was expecting to see 3.2.8
I then ran:
$ gem install rails
Which output:
Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
Installing RDoc documentation for rails-3.2.8...
Then running rails --version again still outputs 2.3.14
I'm a bit confused why a new install (following the instructions here
http://rubyonrails.org/download) seems to have installed a very old
version.
How do I get the latest version installed?
Thanks,
Sounds like you have both versions installed. Run "gem uninstall rails" and it will list the versions and ask which one you want to remove. Then chose the old one to remove.
I've gotten a bit further now. I ran:
F:\>gem cleanup rails
Cleaning up installed gems... Attempting to uninstall rails-2.3.14
You have requested to uninstall the gem:
rails-2.3.14
restful_authentication-1.1.6 depends on [rails (~> 2.3.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Executables and scripts will remain installed.
Successfully uninstalled rails-2.3.14
Clean Up Complete
F:\>gem uninstall restful_authentication
Successfully uninstalled restful_authentication-1.1.6
F:\>gem install rails
Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
Installing RDoc documentation for rails-3.2.8...
F:\>rails -v
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:317:in `bin_path': can't find ge
m rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from C:/Ruby193/bin/rails:23:in `<main>'
So now it's telling me that it's installed rails successfully but now errors when I query it's version.
Related
Trying to install rails version 4.2.5 on Ubuntu in Windows Subsystem for Linux on Windows 10 when I have ruby 2.2.1 installed and active I get the following error:
~$ gem install rails -v 4.2.5
ERROR: Error installing rails:
nokogiri requires Ruby version >= 2.3.0.
I need these versions to collaborate on a project which uses these versions.
I started by installing WSL (1 not 2) on windows 10, then downloaded and installed Ubuntu Linux. Then I installed rbenv, updated dependencies, installed ruby 2.5.1 which was fairly easy.
I had problems installing ruby 2.2.1 but got there after doing
$ sudo apt-get install -y libssl1.0-dev
to install an earlier version of libssl which ruby 2.2.1 needs.
I installed node.js and an earlier version of bundler using
$ gem install bundler -v 1.17.3
as trying
$ gem install bundler
failed with a similar error.
(I also installed ruby 2.5.1 and rails 4.2.5 on top of it with few problems)
Trying various diagnostics showed rails was not installed for ruby 2.2.1
~$ rails
rbenv: rails: command not found
The `rails' command exists in these Ruby versions:
2.5.1
(but not in ruby 2.2.1, which is where I need it)
Looking at my files in windows File Explorer (only looking) I can see that while my ruby 2.5.1 gems include rails my ruby 2.2.1 files are incomplete and do not include rails.
I think the PATH is correct.
$ echo $PATH returns
/home/johnloughran/.rbenv/plugins/ruby- build/bin:/home/johnloughran/.rbenv/shims:/home/johnloughran/.rbenv/bin:/usr/
local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local
/games:/mnt/c/Program
Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_
x64__79rhkp1fndgsc: ........ :/snap/bin
I modified my .bashrc file to add various entries to the PATH which have been included above.
I repeated the whole process twice starting from scratch (uninstalling Ubuntu) with the same block at the end.
What is my best option here to try and continue?
Thanks Josien for your comments. In the first case my collaborators have these versions of Ruby and Rails working together, but its a few years now since they installed them. One, David, helped me by trying a fresh install of rails 4.2.5 on ruby 2.2.1 which ran into the same problem above with nokogiri.
He solved it by installing a lower version of nokogiri in a new test directory, which I repeated as:
test$ gem install nokogiri -v 1.9.1
This worked. Then I installed rails as
test$ gem install rails --version 4.2.5
At last .... it worked!!!! :-)
To prove it I was able to get rails to return its version correctly.
test$ rails -v
Rails 4.2.5
Then I was able to create an app as
<working-directory>$ rails new learn-ruby
which works, almost, having hit another dependency problem, but hey ... that's programming!
Re your second comment I do not know enough about this stuff to know how relevant it is that this version of ruby is deprecated and the rails version is getting there too.
I'm trying to install rails for the 1st time.
I can't seem to get it to install beyond Rails 2.2.3.
I have followed the instructions at:
http://rubyonrails.org/download
I downloaded the latest RubyGems and ran 'ruby setup.rb'.
$ gem -v
1.8.11
I ran 'gem install rails' and got Rails 2.2.3.
I ran 'gem update' several times and I get:
$ gem update
Updating installed gems
Updating rails
Successfully installed rails-2.2.3
Gems updated: rails
Installing ri documentation for rails-2.2.3...
Installing RDoc documentation for rails-2.2.3...
I tried gem1.8:
$ gem1.8 update
Updating installed gems
Updating rails
Successfully installed rails-2.2.3
Gems updated: rails
Installing ri documentation for rails-2.2.3...
Installing RDoc documentation for rails-2.2.3...
$ rails -v
Rails 2.2.3
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux]
I'm using Debian 'unstable' (Wheezy/Sid).
I'm new to rails and don't understand what I'm doing wrong.
I've searched by so far nothing specific to this issue.
I thought the latsted gem would just get Rails 3.1
just as the install docs at the site say?
Any advise much appreciated.
Have you tried this ?
gem install rails --pre
I tried again and it worked fine now.
This time I pointed direct to the
fresh new copy of gem.
All good. Cheers!
I am trying to install Ruby, RubyGems, and the Ruby on Rails framework so that it will play nicely with my system. I am having issues with my installation. Could somebody help me? Here are the details of my system and how I went about installation.
Currently I am running ubuntu 10.10 using the Linux Kernel 2.6.35-28-generic. My server is Apache 2.2.16 and I use MySQL 5.1.49.
So, I went to my synaptic package manager and selected the following packages to download:
* ruby1.8 – installs Ruby 1.8.4
* libmysql-ruby – additional libraries to access MySQL
* libruby1.8-dbg – debugging library
* ri – Ruby Interactive Reference
* ruby1.8-dev – header files for building extensions
* rails – Ruby On Rails framework
Once that ran successfully, I downloaded rubygems from http://rubyforge.org/projects/rubygems/. Then I unpacked it, got in the terminal, ran a cd to get in the directory of the newly downloaded rubygems directory, and typed 'sudo ruby setup.rb' That ran with no problem and RubyGems 1.8.5 was installed. Then I ran 'sudo gem install rubygems-update' with no problem.
But when I ran 'sudo gem install rails –include-dependencies' I got the following output:
Fetching: activesupport-3.0.8.gem (100%)
Fetching: rails-3.0.8.gem (100%)
Successfully installed activesupport-3.0.8
Successfully installed rails-3.0.8
2 gems installed
Installing ri documentation for activesupport-3.0.8...
Installing ri documentation for rails-3.0.8...
File not found: lib
ERROR: While generating documentation for rails-3.0.8
... MESSAGE: exit
... RDOC args: --ri --op /var/www/testingwww/rubygems-1.8.5/nclude-dependencies/doc/rails-3.0.8/ri lib --title rails-3.0.8 Documentation --quiet
When I run 'rails -v' I get 'Rails 3.0.8' so it seems to have installed despite the error. But when I try to make a rails app by typing 'rails ./helloWorld' I get the manual page for the rails keyword.
I have looked around for two days now on how to fix this issue, but can't seem to figure it out. Does anybody know how to fix this?
Rails 3 requires version 1.8.7 or 1.9.2.
I'd recommend using RVM to manage your Ruby installation and environments. It will really help to get you going quickly and is simple. It's as simple as
curl -L https://get.rvm.io | bash
to install RVM and then rvm install 1.9.2 will get you going.
Have a look at https://rvm.io for more information.
In addition to Matthew's good Answer, I don't know why you're doing rails ./helloWorld. To generate a new app in Rails 3, you should do rails new helloWorld.
If you need a complete guide to getting rolling with Rails under Ubuntu, you can find a short guide here: http://blog.dcxn.com/2011/06/21/rolling-with-rails-3-on-ubuntu-11-04/
The gist is:
Install RVM (The Ruby version manager)
Install Rails from gem
Get going with Rails
It's a simple process but there are a few things you need to do for it to be completely smooth like making sure you have the pre-requisites for rvm installed via apt before install rvm.
Good luck!
I'm using Ubuntu 10.10. When I run rails -v, I get 2.3.5. I want to upgrade to 3.0.5, so I run sudo gem install rails. I get
Successfully installed rails-3.0.5
1 gem installed
Installing ri documentation for rails-3.0.5...
Installing RDoc documentation for rails-3.0.5...
I run rails -v again. It still returns 2.3.5. I run sudo apt-get install rails, I get
Reading state information... Done
rails is already the newest version.
Anybody know what I'm doing wrong?
Look at your current gemfile, probably it has record only for rails 2.3.5, if it does then change to 3.0.5. After this just run bundle install
I have an older Ubuntu server with a Rails app running on version 2.3.5 that I'd like to move to version 2.3.8. The server doesn't seem to know that there is an update available, no matter how many times I run a "gem update" or "gem update --system" or "update_rubygems"
root#server:~# gem install rails -v 2.3.8
ERROR: could not find gem rails locally or in a repository
root#server:~# gem install rails
Successfully installed rails-2.3.5
1 gem installed
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for rails-2.3.5...
RubyGems 1.3.5 is installed.
I don't remember having to do anything special for any of my other servers when making this upgrade.
Any ideas?
Try:
gem install rails --source http://rubygems.org
with --source and without -v.