【问题标题】:Rails app is deployed and on, but bundle not seeing railsRails 应用程序已部署并打开,但捆绑包看不到 rails
【发布时间】:2016-11-30 00:08:44
【问题描述】:

我在我的应用程序中使用 Rails 4,并正在使用 Ansible&Capistrano 进行部署。

作为一个 Ansible 模板,我使用的剧本与这个非常相似 - https://github.com/JohnnyR1co/fashcards/blob/master/config/provision/playbook.yml

它安装了 ruby​​ 以及其他任何东西,并且在 cap production deploy 之后我可以看到应用程序(我可以加载一些与数据库无关的页面)。

但是当我尝试从当前文件夹运行类似RAILS_ENV=production rails c 的东西时,我得到了

The program 'rails' can be found in the following packages: * ruby-railties-3.2 * ruby-railties-4.0 Try: apt-get install <selected package>

为什么会这样?应用程序已启动并正在运行,因此 rails 似乎没问题。

此外,当我尝试运行 bundle install 时,我收到一个错误,即 nokogiri 未安装,尽管我在部署后手动安装了它。这可能是什么原因?

我相信问题可能出在playbook.ymlfile 中。 Ruby 安装在那里完成,我不确定它有多正确。

【问题讨论】:

  • 你试过RAILS_ENV=production bundle exec rails c打开控制台吗?
  • 是的,这给了我bundler: command not found: rails Install missing gem executables with "bundle install"
  • 看到类似的帖子:github.com/bundler/bundler/issues/2291
  • 这个线程似乎没有任何工作,同样的错误。我相信问题可能出在playbook.ymlfile 中。 Ruby 安装在那里完成,我不确定它有多正确。

标签: ruby-on-rails ruby nokogiri bundler ansible-playbook


【解决方案1】:

这样就可以了

bundle exec rails c production

【讨论】:

  • 这给出了bundler: command not found: rails Install missing gem executables with "bundle install" 当我尝试捆绑时,我收到一个错误,指出没有安装 nokogiri gem(这不是真的)
  • 检查你是否安装了所有的 gems
猜你喜欢
  • 1970-01-01
  • 2018-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-02
  • 1970-01-01
  • 1970-01-01
  • 2011-06-07
相关资源
最近更新 更多