"rails server" command is not getting recognized - ruby-on-rails

I am new to rails and am following the tutorial posted on the ROR website. Everything is working fine until I try and load up my rails application on the localhost. Every time enter $ rails server I get a long list of possible commands and functions. When I check my localhost:3000 and 127.0.0.1:3000, nothing seems to be connected.
Upon digging deeper, I have tried almost everything everyone else has tried. I am running the command in the same path as my new rails application. Furthermore, when I enter in nonsense after the $ rails command I get the same list of possible commands and functions. So I get the feeling that rails is not recognizing the server command.
Here are my versions:
Ruby 1.9.3 p374
Rails 3.2.11
Why isn't the server command recognized?

First of all you have to move to the project directory and install bundle with the following command:
bundle install
Then start the server:
rails server

I had the same problem. rails server or simply rails s only works when you are in the right directory.
Type pwd (present working directory) to see where you currently are.
Type cd and the rest of the direction to the correct directory.
(for example, "cd workspace/learn-rails")
Type rails server or rails s.
Check http://localhost:3000.

Please exit from terminal and then restart the terminal.
Then check the directory path i.e just type pwd it will show the current directory path.
And if directory is correct on try again running command like bundle install & rails server
I think this should be work.

Related

excute rails server but got output of rails -h

I've followed this article to do this, but after I excuted rails server, he just gave me the output of rails -h, I have no idea about it, somebody help me out!!
Did you created any project yet? you have installed rails correctly. Now you have to create project. If you have created your project than do cd myapp and now run following command
rails s
It should work, I hope you already installed postgres as per tutorial, but if not no worry, following will still work using sqlite3
rails new newmyapp
It will show you screenflow activities. Now it finish just change directory to myapp using cd newmyapp and run following command
rails s
it will show your famous rails page.

Rails command not working on Windows command line

I installed Ruby and Rails and set-up the PATH to "C:\Rails\Ruby2.3.0\bin", but when I try to run commands with rails, I get the error message:
The System cannot find the path specified.
I am able to run commands using ruby, and rails works if I use GitBash. How do I make it work on my normal command line?
Had the same problem here, installed the same way. Couldn't even run rails commands on GitBash, only way was going in C:\Rails\Ruby2.3.0\binthrough cmd and typing, for example, ruby rails new projectname. The rails new projectnamewouldn't work even in these conditions.
What I did was going in the Command Prompt with Ruby and Rails and entered gem install rails (which did not work on cmd). I also did gem install bundle. Both installed successfully and that fixed all consoles for me: cmd, GitBash (wasn't working for me), Command Prompt with Ruby and Rails and even cmder works with Rails now.
Hope this helps you.
Cheers.
If it's a simple question of locating the rails executable on Windows, then on later installs that use msys64 instead of DevKit, you'll find rails at the following folder:
c:\msys64\o-rdoc
Add this to your PATH or execute from that folder.
Your path may vary on 32-bit systems or if you changed the default install folder.

/usr/bin/env: ruby.exe: No such file or directory

I'm brand new to Rails and am following this tutorial on how to make Rails applications. I can't get the database to migrate to my heroku apps.
I'm currently at the beginning of chapter 3, trying to set up an app to use for the rest of the course.
I've been following the tutorial perfectly, and, so far, I've already built two apps and deployed them to heroku and migrated the data just fine, but the third time it's not working.
I was able to make the heroku page and push the app to it, but I just can't migrate the data.
I typed:
heroku run rake db:migrate
and got this error:
/usr/bin/env: ruby.exe: No such file or directory.
I'm assuming this means it's looking for the file in that directory and not finding it. How do I change where it's looking?
I checked "windows heroku run rake db:migrate error “/usr/bin/env: ruby.exe: No such file or directory”" and did what the answers recommended, that is, change "ruby.exe" to "ruby" in bin/bundle, bin/rails, and bin/rake, but that didn't work.
Any other tips? I have been stuck on this for hours. Thank you so much in advance.
The command is normally heroku run rake db:migrate. You should try that instead of heroku run rails db:migrate.
Make sure you've pushed your app to heroku. When it's pushing to heroku, make sure that it is also detected as a rails app. It's possible that heroku isn't detecting a rails app so the environment it sets up doesn't have ruby installed. But it may just be the error in the command name (rails instead of rake).
I had a similar problem on a repository I had ported over from windows.
It turns out that several scripts in the app's bin directory still had a shebang lines (#!/usr/bin/env ruby.exe) to ruby.exe instead of ruby. Once I fixed these scripts the problem went away.
On your local dev machine, before committing to git (and then pushing to Heroku), try changing the line endings to Unix line endings (rather than Windows line endings). On a *nix machine you'd do that by running dos2unix myfile.rb
If the line endings are wrong, the Linux loaded on Heroku will look for ruby^M and not for ruby, and will of course not find it, and give this exact error message.

how to run rails project after doing checkout using svn?

i have checked out a rails project into my svn repository.now i want to run that project on my local server.I entered rails server command to run it but i am getting an error that it cant find or read .yml file.what are the steps to be taken after one checks out some rails project in order to run it on local server.
cd into the directory containing the Gemfile and then do either rails s or bundle exec rails s. The error you are describing usually happens to me when I am not in the same dir as the Gemfile and Rails cannot find the database.yml file.

ruby script\generate controller NOT WORKING

I am following this tutorial and I've run the command ruby script\server and successfully started the server.
Now, when I run ruby script\generate controller MyTest, it says
'ruby' is not recognized as an internal or external command..
This error message means
you dont' have ruby installed (It's on page 1 of your tutorial)
or
ruby is not in your PATH . In that case, check if the PATH points to the folder where you have installed ruby (on Windows I think it's PATH)
Edit:
If you look at the screenshots of the 1st page, the path to ruby is specified all the time
"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" install rails
I did install it on my netbook - I specified to update my PATH but it didnt. After setting up my path correctly, I could type: gem install rails
Sounds like you either haven't installed ruby or it hasn't been added to your PATH environment variable. Use the link text from this page and make sure you open the cmd.exe console AFTER you installed Ruby.

Resources