【问题标题】:Can't start brand new rails app on Heroku无法在 Heroku 上启动全新的 Rails 应用程序
【发布时间】:2020-12-23 15:40:54
【问题描述】:

尝试使用heroku 启动一个全新的rails 项目,按照https://devcenter.heroku.com/articles/getting-started-with-rails5https://devcenter.heroku.com/articles/getting-started-with-rails6 中的步骤操作。两次当我尝试推送到 heroku master 时,我都得到了

remote: -----> Detecting rake tasks
remote: 
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     /tmp/build_4403463c/config/boot.rb:5:in `require': cannot load such file -- bootsnap/setup (LoadError)
remote:  !     from /tmp/build_4403463c/config/boot.rb:5:in `<top (required)>'
remote:  !     from /tmp/build_4403463c/bin/rake:7:in `require_relative'
remote:  !     from /tmp/build_4403463c/bin/rake:7:in `<main>'
remote:  !

我试图用救援包围bootsnap/setup,但它仍然击中了这个街区。

【问题讨论】:

  • 你确定你在 Gemfile 中有gem 'bootsnap'
  • ensure you can run `$ bundle exec rake -P` against your app——嗯,可以吗?
  • 是的,我仔细检查了这两项,bootsnap 已安装,我可以在本地运行 bundle exec rake -P,即使在生产模式下也是如此。我无法检查我的 heroku,因为我第一次推送失败,这意味着该框甚至从未创建。

标签: ruby-on-rails heroku


【解决方案1】:

就我而言,我安装了 3 个捆绑器版本:

gem list bundler

*** LOCAL GEMS ***

bundler (2.2.5, default: 2.1.4, 1.17.3)

虽然 2.1.4 是默认的,但它似乎不是我捆绑安装时使用的。

我运行bundle _2.1.4_ install,然后它会更新我的Gemfile.lock

# git diff
BUNDLED WITH
-   2.2.5
+   2.1.4

然后当我git push heroku main 时问题就消失了。我发现这些链接有助于解决我的问题:Heroku Rails build failing due to Bootsnap and Rake issuesHow to switch bundler version?

【讨论】:

    【解决方案2】:

    找到了解决方案,在Gemfile.lock 中,我将RUBY VERSION 切换为ruby 2.6.6p146,将BUNDLED WITH 切换为1.17.3

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-18
      • 2014-04-05
      • 2021-12-31
      • 2017-10-02
      • 1970-01-01
      • 2012-08-23
      • 2011-07-17
      • 2016-09-11
      相关资源
      最近更新 更多