【问题标题】:running Rails 5.1 console in production在生产环境中运行 Rails 5.1 控制台
【发布时间】:2017-10-18 09:05:43
【问题描述】:

我在 Ubuntu 14.04 服务器上安装了 Rails 5.1 应用程序。

我必须运行一个 Rails 控制台

所以我将目录更改为 cd /opt/www/myapp/current

并输入命令:

rails c production

但随后我收到此错误消息:

程序“rails”可以在以下软件包中找到: * ruby​​-railties-3.2 * ruby​​-railties-4.0 试试:sudo apt-get install

我尝试使用 bundle 运行命令:

bundle exec rails c production

但随后我收到此错误消息:

Gemfile 的未定义局部变量或方法 `git_source' 来自 /opt/www/myapp/releases/20171017091250/Gemfile:3

我不确定发生了什么。

有人可以帮我在生产服务器上运行 rails 控制台吗?

非常感谢,

安东尼

【问题讨论】:

    标签: ruby-on-rails ubuntu-14.04


    【解决方案1】:

    Undefined local variable or method `git_source' for Gemfile

    或者为了避免您访问链接,请尝试:

    gem update bundler
    

    git_source 被添加到 bundler 1.6

    【讨论】:

    • 嗨,马克,谢谢,我更新了 bundler,但在运行 rails c production 时仍然收到此消息:程序“rails”可以在以下包中找到:* ruby​​-railties-3.2 * ruby-railties-4.0
    • 我认为你应该使用:bundle exec rails c production
    • @Smek,如果我尝试运行 bundle exec rails c production,我会收到错误消息:bundler: command not found: rails Install missing gem executables with bundle install
    • 好吧,看来你需要先运行 bundle install。
    【解决方案2】:

    发现问题,我需要运行命令

    bundle exec rails c production
    

    作为“部署”用户

    【讨论】:

      猜你喜欢
      • 2013-02-15
      • 2021-05-22
      • 2015-05-05
      • 1970-01-01
      • 2016-10-22
      • 1970-01-01
      • 2020-06-10
      • 2022-07-05
      • 2016-03-22
      相关资源
      最近更新 更多