【发布时间】: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" -
这个线程似乎没有任何工作,同样的错误。我相信问题可能出在
playbook.ymlfile 中。 Ruby 安装在那里完成,我不确定它有多正确。
标签: ruby-on-rails ruby nokogiri bundler ansible-playbook