Cannot run rails - ruby-on-rails

rails -v
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 have oh-my-zsh installed.
which rails
/usr/bin/rails
How I export PATH in ~/.zshrc:
export PATH=$HOME/bin:/usr/local/bin:/usr/bin:$PATH
When I try to install rails it looks like it's not installing anything (note '0' seconds):
sudo gem install rails
Successfully installed rails-6.0.3.3
Parsing documentation for rails-6.0.3.3
Done installing documentation for rails after 0 seconds
1 gem installed
Any idea why this is happening and how I can fix it?

Seem you have problem with rails -v
If you can, use google translate and try to refer this link https://qiita.com/aki319809/items/9de7f14285cd0c69e2d2

Related

Rails is not currently installed on this system yet I've already installed it

I'm going round in circles getting the "Rails is not installed on this system" message in Terminal, yet it tells me I've just installed it.
Simons-MacBook-Pro:~ Simon$ sudo gem install rails
Successfully installed rails-5.0.2
Parsing documentation for rails-5.0.2
Done installing documentation for rails after 0 seconds
1 gem installed
Simons-MacBook-Pro:~ Simon$ rails -v
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.
Simons-MacBook-Pro:~ Simon$
Is there somewhere in particular I should be installing it?
Solved it. Found I had another copy in another path. Deleted it and moved it into the same directory where I wanted to create the new app.
$sudo rails where
allowed me to find it.

Rails fails to install

I'm trying to install rails on a Mac but am getting some strange errors:
sudo gem install rails
Successfully installed rails-3.2.3
1 gem installed
Installing ri documentation for rails-3.2.3...
file 'lib' not found
Installing RDoc documentation for rails-3.2.3...
file 'lib' not found
rails --version
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.
Anyone got any ideas what I'm doing wrong?
The solution to this problem seems to have been that I already had an install of rails in /usr/bin which was in my PATH first.
This "install" was simply a shell script which gave the output above saying it's not installed.
I removed this by hand and reinstalled everything - after some messing around fixing random errors that it produced and a small edit to my PATH, it seems to be working now.

Ruby on Rails install on ubuntu fail. I can has help?

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!

Accidentally nuked my Rails installation - what do I need to do to recover?

I seem to have broken my Rails installation on Mac OS 10.6.7. Here's the status:
MacBook-Pro$ which ruby
/usr/local/bin/ruby
MacBook-Pro$ which gem
/usr/local/bin/gem
MacBook-Pro$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
MacBook-Pro$ gem -v
1.8.5
I use homebrew to manage these packages:
MacBook-Pro$ brew list
distribute libyaml ossp-uuid python sqlite
gdbm mongodb pip readline wget
git mysql postgresql ruby
My ~/.profile has this:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
Before this ordeal started, I used
sudo gem install rails
I just ran it again and got this:
MacBook-Pro$ sudo gem install rails
Password:
Successfully installed rails-3.0.9
1 gem installed
Installing ri documentation for rails-3.0.9...
file 'lib' not found
Installing RDoc documentation for rails-3.0.9...
file 'lib' not found
But when I run:
which rails
I get nothing in return.
I think at some point I went into /usr/bin/ which is I think the "which rails" pointed to in order to see what was in the rails file. And I think I may have deleted this file. (Yes, I'm an idiot.)
It looks like I somehow need to connect the location of the rails gem with the OS so that it knows it's there? Or can/should I nuke the whole installation? I'd appreciate any guidance!
This might be a good time to switch to using rvm.
https://rvm.io
Try with gem install with -V option, maybe you'll see where it's installing everything. It installs rails for me in /Library/Ruby/Gems/1.8/gems/rails-3.0.9/bin/rails and /usr/bin/rails. It's hacky but you could copy rails from the first location to the second if it doesn't automatically add for you. Best idea is probably to nuke it and start fresh.

Error putting Instant Rails on Windows 7

I am trying to get my Instant Rails working on my Windows 7 laptop.
The error I keep getting when trying to access my site files are:
c:/rails/ruby/lib/site_ruby/1.8/rubygems.rb:779:in 'report_activate_error'
RubyGem version error: rack<1.1.0 not~> 1.0.1> <Gem::LoadError>
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:214:in 'activate'
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:1082:in 'gem'
from c:/depot/vendor/rails/actionpack/lib/action_controller.rb:34
from c://rails/ruby/lib/ruby.site_ruby/1.8/rubygems/custom_require.rb:31 in 'gem_original_require'
etc...
I have intalled Rubygems 1.3.7 and they work fine and when I run the test it works and the gem env shows that the 1.3.7 has been installed correctly.
What can I do to get this working?
Any prompt help would be VERY appreciated.
Thanks
Your rack gem is outdated. Try to run gem update rack. Or, if you use Rails with Bundler, just run bundle install in the root of your project and it will do everything for you.
I decided to write a little manual about the Ruby 1.8.7 and Rails stable installation.
Download RubyInstaller 1.8.7 from here. During the installation, check the 'Add Ruby executables to your PATH' box. After the installation, don't forget to restard cmd. Then try running ruby -v and gem -v to check for installed Ruby 1.8.7 and RubyGems 1.3.7;
Install the latest stable Rails 2.3.8 using gem install rails --no-ri --no-rdoc; Check it using rails -v;
Create a new application using rails myapp;
Test it: script/server. That's it!
gem install rack -v 1.0.1

Resources