heroku推送错误:“无法检测到rake任务"

编程入门 行业动态 更新时间:2024-10-28 07:30:55
本文介绍了heroku推送错误:“无法检测到rake任务"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试部署一个基本的应用程序,但它无法正常工作.使用

I'm trying to deploy a basic app and it's not working. Using

git push heroku master

我收到此错误消息:

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: ! LoadError: cannot load such file -- /tmp/build_a1cfcabff50107f84830d908386197b2/config/application remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/Rakefile:4:in `require' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/Rakefile:4:in `<top (required)>' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run' remote: ! /tmp/build_a1cfcabff50107f84830d908386197b2/vendor/bundle/ruby/2.2.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>' remote: ! vendor/bundle/bin/rake:16:in `load' remote: ! vendor/bundle/bin/rake:16:in `<main>' remote: ! remote: /app/tmp/buildpacks/ruby/lib/language_pack/helpers/rake_runner.rb:102:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)

bundle exec rake -P 似乎工作正常.

我的Gemfile中没有什么特别的,我刚刚添加了Bootstrap:

There's nothing special in my Gemfile, I just added Bootstrap:

source 'rubygems' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.5.1' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' # See github/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: github/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: github/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc gem 'bootstrap-sass' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development #postgreeSQL for Heroku deployment group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' gem 'sqlite3' end group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' # Spring speeds up development by keeping your application running in the background. Read more: github/rails/spring gem 'spring' end group :production do gem 'pg' gem 'rails_12factor' end ruby "2.2.3"

好吧,我不知道为什么会这样,因为我有另一个可以正常工作的项目.我检查了所有内容,仍然给了我该信息.

Well, I don't see why it's happening, since I have another project that is working normally. I checked everything and it still gives me that message.

推荐答案

有时Heroku在部署资产时引发了问题.您可以预编译资产并将其推送到Heroku.

Sometimes Heroku throws an issue on deployment about assets. You can precompile assets and push it to Heroku.

RAILS_ENV=production bundle exec rake assets:precompile

更新:

如果它不起作用,请确保添加 RAILS_SERVE_STATIC_FILES env.到您的服务器.

In case of it doesn't work, make sure to add RAILS_SERVE_STATIC_FILES env. to yr server.

将其设为enabled或true或anything:)

因为在Rails< 5.1 production.rb中具有

Because in Rails <5.1 production.rb has

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

Heroku:应用程序->设置->显示配置变量"

Heroku: App -> Settings -> "Reveal Config Vars"

示例:

更多推荐

heroku推送错误:“无法检测到rake任务"

本文发布于:2023-11-24 08:34:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624489.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:检测到   错误   heroku   rake   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!