【问题标题】:I can't push to heroku, any suggestions?我无法推送到heroku,有什么建议吗?
【发布时间】:2020-08-22 01:36:11
【问题描述】:

我遇到了这个问题,

到目前为止,我有 将 ruby​​、rvm、bootsnap 和 pry 升级到最新版本 当我尝试将我的应用程序推送到 Heroku 时,

$git push 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:  !     rake aborted!
remote:  !     TypeError: no implicit conversion of String into Integer
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
remote:  !   
  ...
...
/tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2.1/lib/active_support/dependencies.rb:291:in `block in require'
remote:  !   
...
...  

/tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require_relative'
remote:  !     ....
.....
/tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:703:in `raw_load_rakefile'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:104:in `block in load_rakefile'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:103:in `load_rakefile'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:82:in `block in run'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/lib/rake/application.rb:80:in `run'
remote:  !     /tmp/build_00cbfd62aabf08d9eeba7a2d621c4bd6/vendor/bundle/ruby/2.7.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
remote:  !     ./vendor/bundle/bin/rake:29:in `load'
remote:  !     ./vendor/bundle/bin/rake:29:in `<main>'
remote:  !
remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
remote: ensure you can run `$ bundle exec rake -P` against your app
remote: and using the production group of your Gemfile.
remote: rake aborted!
remote: TypeError: no implicit conversion of String into Integer

【问题讨论】:

  • 试图按照错误消息中的说明进行操作:$。捆绑执行 rake -P。我得到rake aborted! TypeError: no implicit conversion of String into Integer
  • 做了以下修改:在 database.yml 适配器中:postgresql,并将 bootsnap 更新为 >= 1.3.2...
  • 出现此错误:远程:任务:TOP => 资产:预编译远程:(通过使用--trace 运行任务查看完整跟踪)远程:远程:!偏僻的: !预编译资产失败。偏僻的: !偏僻的: !推送被拒绝,无法编译 Ruby 应用程序。

标签: ruby-on-rails ruby heroku rubygems


【解决方案1】:

问题来自 bootsnap 1.4.1 - 我查看了 gem - 他们的最新版本是 1.4.6,并且 kernel_require.rb 中的代码已从 1.4.1 更改为 1.4.6 - 所以第一件事我建议将此 gem 升级到最新版本并尝试再次推送。

但我建议的下一件事是删除 bootsnap。 Shopify 是一家非常好的 Rails 公司——我确信他们的 gem 可以很好地达到预期目的,但是如果您不确定为什么这个 gem 存在于您的项目中,那么您不应该依赖它。是的 - 似乎他们的 gem 的目的是速度,但相对而言,如果没有这种依赖关系,您的项目是否会变得无法使用?添加一些东西来“加快速度”而不了解您为什么这样做会导致这样的情况,您无法诊断并解决问题。

【讨论】:

  • 嗨,@tgmerritt 我已将 bootsnap 升级到 1.4.6 仍然遇到系统中未检测到 Yarn 可执行文件的问题。
  • 删除这个gem的时候还是不行,显示的信息还是一样的:Yarn executable was not detected in the system.
  • “yarn 可执行文件”错误与您最初发布的错误不同。那应该是一个新帖子,因为它是一个新问题。这个错误特别是字符串没有显式转换为整数。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-12-14
  • 1970-01-01
相关资源
最近更新 更多