Error trying to use Ruby on Rails - ruby-on-rails

It's supposed that I installed Ruby on Rails using RailsInstaller (Windows), but when I try to use the command:
rails -v
The command prompt shows something like:
"System can not find the specified path."
I've uninstalled Rails with 'gem' command and reinstall it, but error still alive.
Is there another way to install Ruby on Rails?
How can I solve this problem?
NOTE: Ruby\bin is in PATH variable.

I found a solution: installing the previous version of RailsInstaller.
I was trying to use: railsinstaller-3.2.0 (Ruby 2.2.4, Rails 4.2)
It worked good with: railsinstaller-3.1.1 (Ruby 2.1.8, Rails 4.2)
NOTE: I'm using W7 OS.

Check out the answer on this one. You have to add rails to path.
Installing Ruby on Rails on windows

Related

Use an older version of Rails with Rails 6 installed

Thank you this community for getting me started on the right path. Specifying rails version to use when creating a new application gets me close, but the differing ruby version is what is throwing me off. I'm running into an error after running rails new that I'm not sure where to begin to resolve it. I gather from the error that my command is missing a parameter, but I can't determine what it is.
Any advice?
I would like to create a rails 5.2.6 project and I'm finding consistent responses elsewhere indicating that my approach to getting a rails project created with a specific version is to:
install the rails gem with gem install rails -v 5.2.6
create a new rails project, specifying the rails version with rails _5.2.6 new appName
I think I'm on to it. Did a specific google search for compatibility of Ruby 3 with Rails 5 and appears this is the likely problem.
I've now run 'rvm install 2.7.4' then 'rvm use 2.7.4' but still seems to be using ruby 3 in the command. The new error:
user#ubuntudev:~/railsprojects$ rails _5.2.6_ new rpapitest
/home/user/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems.rb:281:in `find_spec_for_exe': can't find gem railties (= 5.2.6) with executable rails (Gem::GemNotFoundException)
from /home/user/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems.rb:300:in `activate_bin_path'
from /home/user/.rbenv/versions/3.0.0/bin/rails:23:in `<main>'
Try with rbenv global 2.7.4 if you have rbenv installed

the rails' command exists in these ruby versions 2.1.5

I am using Ruby version 2.2.3 which I've upgraded from 2.1.5. The problem is when I try to execute any Rails command it won't execute and give me this error
the rails' command exists in these ruby versions 2.1.5
So when I switched back to my previous version by rbenv global 2.1.5, it is working again. Can anyone tell me whats going on here? Why I can't do anything with newer version of ruby?
Maybe try to do a gem install rails with your new version.

Getting Rails 1.1.2 server running on Mac script/server

So I'm a rails developer familiar with Rails 3 and 4. I'm taking on a Rails 1.1.2 project, and the first problem I'm having is getting the server running.
I'd really love some help figuring out what I'm missing setting up the environment. When I run script/server, I get:
-bash: script/server: /Users/michael/.rvm/gems/ruby-1.9.3-p545: bad interpreter: Permission denied
This is after noting that at the top of the script/server file, there's an opportunity to define the location of the ruby install with a ruby comment:
#!/Users/michael/.rvm/gems/ruby-1.9.3-p545
At least, this is how I understand it. What should this comment point to? Does this look correct? I've installed ruby 1.9.3 using rvm and installed rails V 1.1.2 through sudo gem install rails. Everything seemed to work fine.
Is this some kind of bash permissions issue? I really don't understand what's going on. Any help would be appreciated!
I believe a rails project that old will require Ruby 1.8.7, so you should start with an older version of Ruby just to be sure. Once you get it running with the older ruby version, you can try 1.9 again, but trying it with 1.8.7 should help you out a bit. Your shebang should be able to do this though:
#!/usr/bin/env ruby
It needs the path of the ruby interpreter, which can be obtained dynamically via the above line.

rails is not found when trying to start a new rails project

I just installed Eclipse, then Ruby 1.9.2 then RailsInstaller. I then installed Aptana plugin for eclipse.
My directory setup are as follows:
C:\Ruby192
C:\RailsInstaller\Ruby1.8.7
When I create a new rails project in Eclipse, It throws this error:
LOL#LOL-PC /d/Projects/rail
$ rails .
sh.exe": rails: command not found
I found this solution, but it seems its for linux. I'm using Windows 7.
I reinstalled rails and ruby but its the same thing. I also had installed GitBash and GitExtensions a few months ago and had this problem. I solved it by pointing to the directory where Git was and setting the Default environment to HOME.
I now have no idea what to do to use ruby on rails in this error.
Add the place where you installed rails to your PATH environment variable. (Presumably C:\Ruby192\lib\ruby\gems\1.9.1\gems\rails*\bin)
I also noticed you are using the RailsInstaller for ruby 1.8.7 but seem to have installed ruby 1.9.2. This may cause trouble in the future.
Try following this guide for installing rails on windows. It uses gem install instead of the out dated RailsInstaller.

How do you change Rails version on a mac?

I've got Snow Leopard with Rails 2.3.5 installed along with other versions (2.2.2 and 1.2.6). I'd like to use 2.2.2 as the webserver I want to deploy to uses a 2.2.x version of Rails. I've tried to uninstall Rails 2.3.5 but get this error:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d rails`
Is there any other way of setting the Rails version to one of the other installed Rails versions?
You should really take look to RVM(Ruby Version Manager) it's awesome!
https://rvm.io
http://teachmetocode.com/screencasts/rvm-ruby-version-manager/
Cheers
Denis
You should be able to do this without needing to uninstall anything. You can specify the version of rails you want to create an application for by typing the following when creating a new app.
rails _2.2.2_ app_name

Resources