Why doesn't “rails s” work from the app directory?

前端 未结 7 2097
醉酒成梦
醉酒成梦 2020-12-09 04:33

I\'m in my app folder, but the command rails s is not working. I read through quite a few posts on Stack Overflow, and most of them seem to be from users who ar

7条回答
  •  抹茶落季
    2020-12-09 04:56

    If you use rvm or rbenv for instance to keep multiple ruby versions, maybe your default rails version for that specific ruby version is different than the project you are trying to run and therefore it's not being able to detect your application.

    To make sure you are using the right rails version you can compare both results. This is what I've got:

    $ rails -v
    Rails 3.1.0
    

    to

    $ bundle exec rails -v
    Rails 5.0.0.1
    

    In this case, you can keep the default rails version and then use:

    $ bundle exec rails server
    

    Or install the specific rails gem to that very ruby version with:

    $ gem install rails -v 5.0.0.1
    $ rails -v
    Rails 5.0.0.1
    

    And then get it working with the less verbose command:

    $ rails s
    

    I hope this becomes helpful to other folks in the same situation!

提交回复
热议问题