[英]Heroku push error: "Could not detect rake tasks" ( Rails 6.1 )
我有一個“Rails 6.1.1”應用程序。 每當我嘗試部署它時,我都會收到此錯誤-
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:
我正在嘗試使用 -
git push heroku master
這是我的 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]
我剛剛開始構建應用程序,並嘗試使用基本的 controller 部署它。 我檢查了所有內容,它仍然給了我這個信息。 它在本地主機中完美運行。
rake assets:precompile --dry-run
然后如果你看到錯誤解決它然后運行
rake assets:precompile
我在bundler version 2.2.4
上遇到了同樣的錯誤。 在我閱讀下面鏈接的帖子並降級到bundler version 2.1.4
后,它為我解決了錯誤。
我嘗試了rake assets:precompile
並按照 heroku 的建議指定鎖定的平台。
這是我第一次部署到 heroku 並且在我第一次部署之前我沒有將RAILS_MASTER_KEY
設置為配置變量。 一旦我設置好了,部署就成功通過了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.