【问题标题】:The program 'rails' is currently not installed in the root of a Rails app folder程序“rails”当前未安装在 Rails 应用程序文件夹的根目录中
【发布时间】:2014-12-14 03:44:52
【问题描述】:

我在服务器上有一个 Rails 应用程序,并且仅在服务器上。从某种意义上说,它不是我的,我不是开发它的人。它在 Rails 2 和 3 中,在 Gemfile 中有一个条件,它是否包含 Rails 2 或 3 gem。我需要在服务器上运行一些 Rails 操作,例如rails console, rails g migration。但是,当我运行 rails 时:

root@server123:/some_path# rails 
The program 'rails' is currently not installed.  You can install it by typing:
apt-get install rails

这是怎么回事,我该如何解决?

# cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS"
NAME="Ubuntu"
VERSION="12.04.4 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.4 LTS)"
VERSION_ID="12.04"

更新:

# bundle exec rails console
/web/my_app1/shared/bundle/ruby/1.9.1/bundler/gems/rails-e86daf8ff727/activesupport/lib/active_support/inflector.rb:3:in `<top (required)>': iconv will be deprecated in the future, use String#encode instead.
/web/my_app1/shared/bundle/ruby/1.9.1/bundler/gems/rails-e86daf8ff727/railties/lib/rails_generator/generators/applications/app/app_generator.rb:7: Use RbConfig instead of obsolete and deprecated Config.
      create  
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers
      create  config/locales
      //.... and so on

当我第二次运行时,它显示“存在”而不是“创建”。它创造了什么?为什么它不运行 rails 控制台?

【问题讨论】:

  • 它可能由 bundler 安装。试试bundle exec rails
  • @shirakia,谢谢。请看我的更新。
  • 重启终端会话或系统可能有帮助
  • @Nithin,我重新启动它,它没有帮助。系统呢?
  • 这听起来像是一个 rails 2 应用程序——“rails 控制台”是 rails 3 中的新功能,之前您使用的是 ruby​​ 脚本/控制台

标签: ruby-on-rails ruby linux ubuntu


【解决方案1】:

试试这个命令 /bin/bash --login 在您的终端中,然后尝试使用 rails。我认为它应该工作

【讨论】:

    【解决方案2】:

    您以 root(root@server123:/some_path) 身份登录服务器。
    Rails 可能是通过部署用户安装的。通过该用户确认您使用哪个用户部署 code.ssh,然后尝试运行控制台。

    【讨论】:

      猜你喜欢
      • 2018-02-28
      • 2012-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多