Rails 控制台无法在服务器上运行

问题描述:

当我通过 SSH 在 Capistrano 部署的 Current 文件夹中的服务器上运行 bundle exec rails console productionrails console production 时,我得到:

When I run bundle exec rails console production or rails console production via SSH on the server in the Current folder of the Capistrano deploy I get:

Usage:
     rails new APP_PATH [options]

Options:
    (...)

带有启动新应用程序的说明.在本地它有效.为什么我不能远程启动控制台?

with an explanation to start a new app. Locally it works. Why can't I start a console remotely?

我假设您从版本 3 更新到 rails 4 并且您的应用程序在 bin 目录.运行此命令以查看您的 Rails 版本:

I'm assuming that you updated to rails 4 from version 3 and your app can't find the executables in the bin directory. Run this to see your rails version:

$ rails -v

如果您的 rails 版本是 4 或更高版本,请尝试运行:

If your rails version is 4 or above, try running this:

$ rake rails:update:bin

来源:Rails 4 发行说明

  • 您应用的可执行文件现在位于 bin/ 目录中.运行 rake rails:update:bin 以获取 bin/bundlebin/railsbin/rake.

6.1 Notable changes

  • Your app's executables now live in the bin/ dir. Run rake rails:update:bin to get bin/bundle, bin/rails, and bin/rake.