[英]Heroku bundler undefined method "present?", fails to install gems via bundler
尝试将 rails 应用程序推送到 Heroku 时遇到一个奇怪的错误:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.16
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.0.1
remote: -----> Installing dependencies using bundler 2.2.16
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote: /tmp/build_ae8e646d/bin/bundle:42:in `gemfile': undefined method `present?' for "/tmp/build_ae8e646d/Gemfile":String (NoMethodError)
remote: Did you mean? prepend
remote: from /tmp/build_ae8e646d/bin/bundle:49:in `lockfile'
remote: from /tmp/build_ae8e646d/bin/bundle:57:in `lockfile_version'
remote: from /tmp/build_ae8e646d/bin/bundle:68:in `bundler_version'
remote: from /tmp/build_ae8e646d/bin/bundle:72:in `bundler_requirement'
remote: from /tmp/build_ae8e646d/bin/bundle:100:in `activate_bundler'
remote: from /tmp/build_ae8e646d/bin/bundle:88:in `load_bundler!'
remote: from /tmp/build_ae8e646d/bin/bundle:116:in `<main>'
remote: Bundler Output: /tmp/build_ae8e646d/bin/bundle:42:in `gemfile': undefined method `present?' for "/tmp/build_ae8e646d/Gemfile":String (NoMethodError)
remote: Did you mean? prepend
remote: from /tmp/build_ae8e646d/bin/bundle:49:in `lockfile'
remote: from /tmp/build_ae8e646d/bin/bundle:57:in `lockfile_version'
remote: from /tmp/build_ae8e646d/bin/bundle:68:in `bundler_version'
remote: from /tmp/build_ae8e646d/bin/bundle:72:in `bundler_requirement'
remote: from /tmp/build_ae8e646d/bin/bundle:100:in `activate_bundler'
remote: from /tmp/build_ae8e646d/bin/bundle:88:in `load_bundler!'
remote: from /tmp/build_ae8e646d/bin/bundle:116:in `<main>'
remote:
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
在此之前,我已经将应用程序的脚手架部署到 Heroku 并且一切正常。 但是在工作了一段时间并推动更改后,出现了错误。
已经尝试过重新生成 Gemlock.file 和包更新,但没有运气。 在本地,一切正常。 Ruby 和捆绑器版本在本地和 Heroku 上是相同的。 现在,不知道那可能是什么。 有没有人遇到过这样的错误?
找到了解决方案。 问题是 rubocop 修改了 /bin/bundle 文件中的 42 行, return gemfile if gemfile.present?
,其中通过错误。 return gemfile if gemfile &&.gemfile?empty?
一切正常。 希望,这会帮助某人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.