【发布时间】:2021-05-16 03:29:18
【问题描述】:
我得到错误:
remote: ! Could not detect rake tasks
04:36
remote: ! ensure you can run `$ bundle exec rake -P` against your app
04:36
remote: ! and using the production group of your Gemfile.
04:36
remote: ! /tmp/build_aa020f9e/bin/rake:8:in `require': cannot load such file -- rake (LoadError)
04:36
remote: ! from /tmp/build_aa020f9e/bin/rake:8:in `<main>'
从 Codeship 运行 Heroku 部署管道时
/bin/rake 是这样的
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
所以第 8 行需要 'rake'
我尝试将 gem rake 显式添加到我的 gemfile 中
然后因为提到生产组我尝试了
group :production do
gem 'rake'
end
这些都不起作用,所以我的代码推送被 Heroku 拒绝了
remote: ! Push rejected, failed to compile Ruby app.
04:36
remote:
04:36
remote: ! Push failed
有什么想法吗?我在 StackOverflow rails cannot load such file -- rake (LoadError) 上看到了类似的帖子,但没有解决方案?
【问题讨论】:
-
尝试使用 bundle exec command_to_be_executed,比如 bundle exec sidekiq。
-
Push rejected, failed to compile Ruby app.查看build.log编译 Ruby 应用程序失败的原因。 -
感谢大家的回复,但失败的是 git push heroku a)我看不到我可以“捆绑执行”这个命令,b)我已经从 build.log 发布了错误。由于以下错误,Ruby 应用程序无法构建:/tmp/build_aa020f9e/bin/rake:8:in `require': cannot load such file -- rake (LoadError) from require 'rake' in bin/rake
标签: ruby-on-rails heroku deployment rake