【发布时间】:2016-10-31 06:17:01
【问题描述】:
我正在尝试将 rails 5 应用程序推送到 Heroku,并且我相信我遵循了 Heroku 页面上的说明: https://devcenter.heroku.com/articles/ruby-versions
$ ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
$ cat Gemfile
.....
ruby "2.3.1"
$ heroku run bash
$ env | grep PATH
PATH=/app/bin:/usr/local/bin:/usr/bin:/bin
$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
以错误终止:
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NoMethodError: undefined method `symbolize_keys' for # <String:0x007fac0655feb0>
remote: /tmp/build_39bfaebc9acd5a6bcb91a69f2b13c171/vendor/bundle/ruby/2.2.0/gems /railties-5.0.0.1/lib/rails/application.rb:393:in `secrets'
我猜是因为它使用的是 2.2 而不是 2.3。
/bin 中的版本是 1.9.3,所以如果找不到,它应该使用 1.9.3 而不是 2.2.4。
上面的错误信息已在 spickermann 的帮助下得到修复。从 git 跟踪中删除 secret.yml 文件后,应用可以顺利部署。
仍然存在错误的 Ruby 版本,Heroku 甚至在最后返回警告:
remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.2.4'
remote: # See https://devcenter.heroku.com/articles/ruby- versions for more information.
还有什么可以做的建议吗?
谢谢!
【问题讨论】:
-
我忘了说 bin/bundle 和指南中的完全一样
-
$ bundler --version Bundler 版本 1.13.6
标签: ruby-on-rails ruby heroku