Hero Error: "Could not detect rake problems"

I am trying to deploy a basic application and it is not working. Using

git push heroku master 

I got this error message:

 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 working fine.

Nothing special in my Gemfile, I just added Bootstrap:

 source 'https://rubygems.org' # 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 https://github.com/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: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/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: https://github.com/rails/spring gem 'spring' end group :production do gem 'pg' gem 'rails_12factor' end ruby "2.2.3" 

Well, I don’t understand why this is happening, since I have another project that works fine. I checked everything and it still gives me this message.

+16
source share
5 answers

Heroku sometimes asks about asset allocation. You can precompile the resources and send them to Heroku.

 RAILS_ENV=production bundle exec rake assets:precompile 

Update:

In case this does not work, be sure to add RAILS_SERVE_STATIC_FILES env. to your server.

Make it enabled or true nor anything :)

Because in Rails <5.1 production.rb has

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

Heroku: Application β†’ Settings β†’ "Show Settings"

Sample: enter image description here

+7
source

"Any failure to compile resources will now cause the push request to fail. For information on supporting the resource pipeline in Rails 5, see the Ruby support page."

The Rails resource pipeline provides the rake "precompile asset" task, which allows you to compile and cache resources in advance, rather than compiling each time the application loads. There are two ways to use the asset pipeline on Heroku. Compiling resources locally. Compilation of assets during bullet compilation.

To compile your resources locally, run the assets: precompile task locally in your application. Make sure you use the production environment to create a working version of your assets.

Before you can compile your resources on Heroku, you need to be able to compile them locally, run this command to debug your resources:

 RAILS_ENV=production bundle exec rake assets:precompile 

This should complete without error. DO NOT check resources in git after running this command if using Rails 3 according to Heroku documentation.

A public directory / resource directory will be created. Inside this directory you will find a manifest.yml file that includes md5sums of compiled resources in Rails 3. In Rails 4, the file will be manifest-.json. Adding public / assets to your git repository will make it available to Heroku.

 git add public/assets git commit -m "vendor compiled assets"' 

Now, when clicked, the output should show that your locally compiled assets have been detected:

 -----> Preparing Rails asset pipeline Detected manifest.yml, assuming assets were compiled locally 

More help can be found here.

And here

+5
source

use rbenv to install ruby ​​2.6.0

  rbenv install 2.6.0 

Then go to your project directory and install the ruby ​​version

  rbenv local 2.6.0 

Remove installation packages

  gem uninstall bundler 

Then install the last package, the last package will be installed below

  gem install bundler 

Then you have to go.

0
source

I took all these steps while trying to resolve the same error:

 remote: -----> Installing node-v10.15.3-linux-x64 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: ! Activating bundler (2.0.1) failed: remote: ! Could not find 'bundler' (2.0.1) required by your /tmp/build_2e6c96ff8cd3ab115ee56c51d05c7a28/Gemfile.lock. remote: ! To update to the latest version installed on your system, run 'bundle update --bundler'. remote: ! To install the missing version, run 'gem install bundler:2.0.1' remote: ! Checked in 'GEM_PATH=/tmp/build_2e6c96ff8cd3ab115ee56c51d05c7a28/vendor/bundle/ruby/2.6.0', execute 'gem env' for more information remote: ! remote: ! To install the version of bundler this project requires, run 'gem install bundler -v '2.0.1'' 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) 

What happened when trying to deploy in the same way. I have followed all the commands in the production environment that give an error message but which still have not resolved. My versions:

 ~/movie_list [master] $ ruby -v ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] ~/movie_list [master] $ bundler version Bundler version 2.0.1 (2019-01-04 commit d7ad2192f) 

The solution that worked for me finally came from this question I found on bundler. In order to deploy, I had to remove

 BUNDLED WITH 1.17.1 

from my gemfile.lock, and then use git push heroku master .

0
source

You can also add PG gem file to production in your gem file

Gemfile

 group :production do gem 'pg' gem 'rails_12factor' end group :development do gem 'sqlite3' end 

OR:

 # Use sqlite3 as the database for Active Record gem 'sqlite3', group: [:development, :test] gem 'rails_12factor', group: :production gem 'pg', group: :production 

Once you have added that there save and run the following:

Terminal

 gem install bundler bundle install git add . git commit -m "Some comment here..." git push heroku master 
0
source

Source: https://habr.com/ru/post/1246373/


All Articles