Rails server does not start by command “Rails s”

前端 未结 6 463
甜味超标
甜味超标 2020-12-18 21:48

I\'m new to ruby and rails and i installed rails in to the ubuntu. but when i go to the start server by typing \"rails s\" it doesn\'t start and comes following message . bu

相关标签:
6条回答
  • 2020-12-18 22:17

    Before starting the rails server, you have to cd into the directory of your application. That's because the server needs to know which application it's supposed to be serving.

    0 讨论(0)
  • 2020-12-18 22:35

    I am also new to Ruby on rails. I find the same issue when accidentally my PC shutdown. I fix it by following steps.

    1. Create a new application. Rails new demo --Database=postgresql

    2. Copy the Bin folder of new Demo app.

    3. Remove the Bin folder of old App(That showing error)

    4. Paste the New bin folder from Demo App to old App.

    5. Start the server Rails server

    Note you can copy the bin folder from Github. https://github.com/hoovercj/depot

    0 讨论(0)
  • 2020-12-18 22:36
    1. You need to create a new Rails app (unless you already have one)

      rails new my_app
      
    2. Go to your app directory

      cd my_app
      
    3. Start the server in that directory

      rails s
      
    0 讨论(0)
  • 2020-12-18 22:37

    A better method is to update your bin using following command

    bundle exec rake rails:update:bin
    
    0 讨论(0)
  • 2020-12-18 22:39

    Once you have created the project and cd'd into it:

    Use script/server if you are on rails version 2.x

    Use script/rails server if you are on rails version 3.x

    Use bin/rails server if you are on rails version 4.x

    0 讨论(0)
  • 2020-12-18 22:43

    I ran into this problem and was confused for a minute until I realized I accidentally deleted my bin folder.

    How to fix it:

    1. Backup your app.
    2. cd back out of the root of the Rails app.
    3. Run rails new name_of_your_app -- make sure it's the same name as the directory that already exists.
    4. Rails will build the folder again, asking you if you want to overwrite files, hit n for "no" each time it asks.
    5. Rails will add the missing bin files, whereas if you hit n for everything else it will keep everything else.
    6. In my case I was using HAML with an application.html.haml file, and so Rails also generated an application.html.erb file for me in views/layouts which I didn't need and so deleted. Notice any other files that were generated and delete any you don't want.
    7. Run rails s to start the WEBrick server.
    0 讨论(0)
提交回复
热议问题