Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue deploying to Heroku with standard/rake #1130

Closed
lpender opened this issue Aug 15, 2023 · 3 comments
Closed

Issue deploying to Heroku with standard/rake #1130

lpender opened this issue Aug 15, 2023 · 3 comments

Comments

@lpender
Copy link
Contributor

lpender commented Aug 15, 2023

It looks like Heroku tries to run: bundle exec rake -P in production mode when the app is deployed, and fails because the standard gem is only installed in development and test environments.

@lpender
Copy link
Contributor Author

lpender commented Aug 15, 2023

When trying to build a fresh Suspenders app on Heroku:

-----> Detecting rake tasks

 !
 !     Could not detect rake tasks
 !     ensure you can run `$ bundle exec rake -P` against your app
 !     and using the production group of your Gemfile.
 !     rake aborted!
 !     LoadError: cannot load such file -- standard/rake
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
 !     /tmp/build_ca4ab55b/Rakefile:1:in `<main>'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load_rakefile'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:710:in `raw_load_rakefile'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:104:in `block in load_rakefile'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:103:in `load_rakefile'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:82:in `block in run'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
 !     /tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
 !     /tmp/build_ca4ab55b/bin/rake:4:in `<main>'
 !
/tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/helpers/rake_runner.rb:100:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
ensure you can run `$ bundle exec rake -P` against your app
and using the production group of your Gemfile.
rake aborted!
LoadError: cannot load such file -- standard/rake
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/tmp/build_ca4ab55b/Rakefile:1:in `<main>'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load_rakefile'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:710:in `raw_load_rakefile'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:104:in `block in load_rakefile'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:103:in `load_rakefile'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:82:in `block in run'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/tmp/build_ca4ab55b/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/tmp/build_ca4ab55b/bin/rake:4:in `<main>'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/ruby.rb:967:in `rake'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails4.rb:69:in `block in run_assets_precompile_rake_task'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/base.rb:175:in `log'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails4.rb:63:in `run_assets_precompile_rake_task'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/ruby.rb:103:in `block in compile'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/ruby.rb:988:in `allow_git'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/ruby.rb:96:in `compile'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails2.rb:55:in `compile'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails3.rb:37:in `compile'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails4.rb:30:in `compile'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails6.rb:17:in `compile'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/bin/support/ruby_compile:19:in `block in <main>'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/base.rb:175:in `log'
	from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/bin/support/ruby_compile:18:in `<main>'
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

@lpender lpender changed the title Issue deploying to Heroku | cannot load such file -- standard/rake Issue deploying to Heroku with standard/rake Aug 15, 2023
@lpender lpender changed the title Issue deploying to Heroku with standard/rake Issue deploying to Heroku with standard/rake Aug 15, 2023
@stevepolitodesign
Copy link
Contributor

Thank you for raising this issue. I created a new suspenders app locally, and was able to run both RACK_ENV=production bundle exec rake -P and RAILS_ENV=production bundle exec rake -P locally without issue.

I did stumble upon this StackOverflow post that suggests this issue has to do with specific bundler versions, although this Heroku article claims that's not an issue anymore.

For me, I was running version 2.4.3 of bundler.

# Gemfile.lock
BUNDLED WITH
   2.4.3

What version are you running?

@stevepolitodesign
Copy link
Contributor

Closed by #1135 and #1186.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants