7

I have created a new rails project with the command:

rails project_name

but now in that project if I run:

rails server

I just creates a new project call server, it doesn't start webrick.

How do I start the server and get rails running?

CafeHey
  • 5,699
  • 19
  • 82
  • 145
  • Actually guys, if I do a -v to see which version of rails I have it says 3.0.3. But if I run script/server it's works and says it's version 2. What the hell's going on. – CafeHey Dec 15 '10 at 23:06

4 Answers4

6

Old versions or rails are bugging you. Deinstall them using gem uninstall rails. I recommend using RVM with gemsets to create separate environments for each project.

iain
  • 16,204
  • 4
  • 37
  • 41
3

You're mixing Rails 2 and Rails 3 commands. By the looks of it, you're using Rails 2, which means starting the server would be script/server, not rails server

idlefingers
  • 31,659
  • 5
  • 82
  • 68
  • 1
    If that's the case then you would've needed to use `rails new new_project` to create the project. The `rails new_project` syntax has been removed since all the old script/* commands have been moved into the rails command. Double-check with `rails -v` – idlefingers Dec 15 '10 at 22:12
  • @Smickie I wouldn't be so sure, type rails -v to find out. – mxmissile Dec 15 '10 at 22:13
  • 1
    Actually guys, if I do a -v to see which version of rails I have it says 3.0.3. But if I run script/server it's works and says it's version 2. What the hell's going on. – CafeHey Dec 15 '10 at 23:03
  • If script/server even exists, it means it's a Rails 2 app. It means you've got rails 3 installed but the app needs upgrading. – idlefingers Dec 15 '10 at 23:05
  • For me, neither `rails server` nor `rails script/server` start webrick. `rails -v` outputs `Rails 2.3.14`, how can I start webrick? – Shawn Mar 27 '12 at 04:38
  • In Rails 2 and below, it's just `script/server`, not `rails script/server` – idlefingers Mar 27 '12 at 15:21
  • `script/server` outputs `-bash: script/server: No such file or directory` – Shawn Mar 27 '12 at 17:18
1

Step by Step rails server Installation :

  1. Create Gemset using " rvm create gemset "
  2. rails new
  3. goto rails app directory "cd/"
  4. gem install rails
  5. echo "rvm use " > .rvmrc for example : echo "rvm use 1.9.3-p385@mygemset" > .rvmrc
  6. run - "bundle install"
  7. rails s

yeah, nothing to do more... :)

SSR
  • 6,398
  • 4
  • 34
  • 50
0

I had this problem on Ubuntu and found that I had rails 3 installed with gem and rails 2 installed with apt. Removing the apt version solved the issue:

sudo apt-get remove rails
shangxiao
  • 1,206
  • 11
  • 10