typing 'rails console' doesn't start?

前端 未结 9 1266
花落未央
花落未央 2020-12-05 22:57

I typed this:

>rails console

and got this:

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-gemfile]                


        
相关标签:
9条回答
  • 2020-12-05 23:52

    Are you in the root path of your app when you type $ rails console?

    Tip: $ rails c is a shortcut for $ rails console

    0 讨论(0)
  • 2020-12-05 23:52

    In case anyone else hits this, my symptoms were:

    I'd deployed my application with Capistrano 3

    I cd'd into my application directory, and rails console didn't work

    Turned out I'd included the bin folder as a symlinked directory in my cap deploy, as follows:

    set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

    ... and my bin directory in 'shared' was empty.

    Two fixes:

    • Ensure your linked bin directory has the correct contents (have a look inside your #{RAILS_ROOT}/bin directory for what this is, OR
    • Don't symlink bin

    I then re-deployed and it works.

    0 讨论(0)
  • 2020-12-05 23:52

    You are running the correct command (rails console), but you are most likely not in the working directory for this application. Change directory to the root of your rails application (beneath which you will find /scripts, /app, etc.), and the command should work as desired.

    Note: Using script/console or ruby script/console is for earlier versions of Rails.

    0 讨论(0)
提交回复
热议问题