2

I have a "Rails 6.1.1" application. Whenever I'm trying to deploy it I'm getting this error -

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_05dae8c4/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
remote:  !     from /tmp/build_05dae8c4/config/boot.rb:4:in `<top (required)>'
remote:  !     from /tmp/build_05dae8c4/bin/rake:3:in `require_relative'
remote:  !     from /tmp/build_05dae8c4/bin/rake:3:in `<main>'
remote:

I'm trying to deploy it using -

git push heroku master 

Here is my Gemfile -

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.2'

gem 'rails', '~> 6.1.1'
gem 'puma', '~> 5.0'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 5.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bcrypt', '~> 3.1.7'

gem 'bootsnap', '>= 1.4.4', require: false

group :development, :test do
  gem 'sqlite3', '~> 1.4'
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 4.1.0'
  gem 'rack-mini-profiler', '~> 2.0'
  gem 'listen', '~> 3.3'
  gem 'spring'
end

group :test do
  gem 'capybara', '>= 3.26'
  gem 'selenium-webdriver'
  gem 'webdrivers'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

I just started building the app and I was trying to deploy it with a basic controller. I checked everything and it still gives me that message. It's working perfectly in localhost.

Sanjib Roy
  • 59
  • 6

4 Answers4

0
rake assets:precompile --dry-run

And then if you see errors solve it and then run

rake assets:precompile

adityapandit17
  • 356
  • 1
  • 8
  • * It didn't work. Error is still appears * Yes, there was an error and it also suggested me to run `bundle update`. After running that and `bundle install` I run `rake assets:precompile --dry-run` again. Then it was showing this - ` ** Invoke assets:precompile (first_time) ** Invoke assets:environment (first_time) ** Execute (dry run) assets:environment ** Invoke yarn:install (first_time) ** Execute (dry run) yarn:install ** Execute (dry run) assets:precompile ` Although I pushed it to heroku after running your suggested 2 commands but it still showing the same error. – Sanjib Roy Jan 09 '21 at 07:58
  • Did you try it with the --dry-run – adityapandit17 Jan 09 '21 at 11:43
  • Yes, I did and it suggested me to run ```bundle update```. – Sanjib Roy Jan 09 '21 at 14:31
0

I was on bundler version 2.2.4 and faced the same error. After I read the post linked below and downgraded to bundler version 2.1.4, it solved the error for me.

https://stackoverflow.com/a/65333470/12483010

imgyf
  • 1
  • 1
0

I fixed with rake assets:precompile after reading this and this

Andrey B
  • 11
  • 1
  • 3
0

I tried rake assets:precompile and specifying locked platforms as recommended by heroku.

This was my first deploy to heroku and I didn't set the RAILS_MASTER_KEY as a config variable before my first deploy. Once I set that, the deploy successfully went through.

computer_smile
  • 2,117
  • 2
  • 24
  • 42