Home>

Please write your question in detail here.
rails server cannot start

[vagrant @ localhost sample_app] $rails server -b 0.0.0.0
rbenv: rails: command not found

The `rails' command exists in these Ruby versions: 2.5.7

[vagrant @ localhost sample_app] $

Corresponding source code
Source code
What I tried

Please describe here what you have tried for the problem.

I tried to install the version 2.5.7 in the message
Not found.
Is it because the version of ruby ​​is old?

Supplementary information (FW/tool version, etc.)

Please provide more detailed information here.

  • Answer # 1

    It means that rails is installed in ruby ​​2.5.7 which is versioned by rbenv.
    It seems that the version of ruby ​​currently running is different.

    As a temporary solutionbundle exec rails sCall rails described in Gemfile as
    Or./bin/rails sThere seems to be a way to call rails installed under ./bin.

    rbenv local 2.5.7There seems to be a way to change it to use ruby ​​2.5.7. (If you don't want sample_app to be used in a particular version)