将 Rails 应用程序部署到 Heroku 的问题无法加载此类文件 -- rake

问题描述

我正在尝试将我在本地开发的 Rails 应用程序部署到 Heroku,但我在运行时遇到以下错误

git push heroku origin
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_fd23eb4a/bin/rake:4:in `require': cannot load such file -- rake (LoadError)
remote:  !     from /tmp/build_fd23eb4a/bin/rake:4:in `<main>'
remote:  !

我尝试使用以下输出运行 bundle exec rake -P RAILS_ENV=production:

rake about
    environment
rake action_mailBox:ingress:environment
rake action_mailBox:ingress:exim
    action_mailBox:ingress:environment
rake action_mailBox:ingress:postfix
    action_mailBox:ingress:environment
rake action_mailBox:ingress:qmail
    action_mailBox:ingress:environment
rake action_mailBox:install
rake action_mailBox:install:migrations
rake action_text:install
rake action_text:install:migrations
rake active_storage:install
    environment
rake active_storage:install:migrations
rake active_storage:update
    environment
rake app:binstub:yarn
rake app:template
    environment
rake app:templates:copy
rake app:update
    update:configs
    update:bin
    update:active_storage
    update:upgrade_guide_info
rake app:update:active_storage
rake app:update:bin
rake app:update:configs
rake app:update:upgrade_guide_info
rake assets:clean
    environment
rake assets:clobber
    environment
rake assets:environment
rake assets:precompile
    environment
    yarn:install
rake cache_digests:dependencies
    environment
rake cache_digests:nested_dependencies
    environment
rake db:_dump
rake db:abort_if_pending_migrations
    load_config
rake db:charset
    load_config
rake db:check_protected_environments
    load_config
rake db:collation
    load_config
rake db:create
    load_config
rake db:create:all
    load_config
rake db:drop
    load_config
    check_protected_environments
rake db:drop:_unsafe
    load_config
rake db:drop:all
    load_config
    check_protected_environments
rake db:environment:set
    load_config
rake db:fixtures:identify
    load_config
rake db:fixtures:load
    load_config
rake db:forward
    load_config
rake db:load_config
    environment
rake db:migrate
    load_config
rake db:migrate:down
    load_config
rake db:migrate:redo
    load_config
rake db:migrate:reset
    db:drop
    db:create
    db:migrate
rake db:migrate:status
    load_config
rake db:migrate:up
    load_config
rake db:prepare
    load_config
rake db:purge
    load_config
    check_protected_environments
rake db:purge:all
    load_config
    check_protected_environments
rake db:reset
    db:drop
    db:setup
rake db:rollback
    load_config
rake db:schema:cache:clear
    load_config
rake db:schema:cache:dump
    load_config
rake db:schema:dump
    load_config
rake db:schema:load
    load_config
    check_protected_environments
rake db:schema:load_if_ruby
    db:create
    environment
rake db:seed
    load_config
rake db:seed:replant
    load_config
    truncate_all
    seed
rake db:setup
    db:create
    environment
    db:schema:load
    seed
rake db:structure:dump
    load_config
rake db:structure:load
    load_config
    check_protected_environments
rake db:structure:load_if_sql
    db:create
    environment
rake db:test:load
    db:test:purge
rake db:test:load_schema
    db:test:purge
rake db:test:load_structure
    db:test:purge
rake db:test:prepare
    load_config
rake db:test:purge
    load_config
    check_protected_environments
rake db:truncate_all
    load_config
    check_protected_environments
rake db:version
    load_config
rake default
    test
rake environment
rake log:clear
rake middleware
    environment
rake railties:install:migrations
    db:load_config
rake restart
rake secret
rake stats
rake test
rake test:all
    test:prepare
rake test:channels
    test:prepare
rake test:controllers
    test:prepare
rake test:db
    db:test:prepare
    test
rake test:functionals
    test:prepare
rake test:generators
    test:prepare
rake test:helpers
    test:prepare
rake test:integration
    test:prepare
rake test:jobs
    test:prepare
rake test:mailBoxes
    test:prepare
rake test:mailers
    test:prepare
rake test:models
    test:prepare
rake test:prepare
rake test:run
    test
rake test:system
    test:prepare
rake test:units
    test:prepare
rake time:zones
rake time:zones:all
rake time:zones:local
rake time:zones:us
rake tmp
rake tmp/cache
rake tmp/cache/assets
rake tmp/pids
rake tmp/sockets
rake tmp:cache:clear
rake tmp:clear
    tmp:cache:clear
    tmp:sockets:clear
    tmp:screenshots:clear
rake tmp:create
    tmp/cache
    tmp/sockets
    tmp/pids
    tmp/cache/assets
rake tmp:pids:clear
rake tmp:screenshots:clear
rake tmp:sockets:clear
rake webpacker
rake webpacker:binstubs
    check_node
    check_yarn
rake webpacker:check_binstubs
rake webpacker:check_node
rake webpacker:check_yarn
rake webpacker:clean
    webpacker:verify_install
    environment
rake webpacker:clobber
    webpacker:verify_install
    environment
rake webpacker:compile
    webpacker:verify_install
    environment
rake webpacker:info
rake webpacker:install
    check_node
    check_yarn
rake webpacker:install:angular
    webpacker:verify_install
rake webpacker:install:coffee
    webpacker:verify_install
rake webpacker:install:elm
    webpacker:verify_install
rake webpacker:install:erb
    webpacker:verify_install
rake webpacker:install:react
    webpacker:verify_install
rake webpacker:install:stimulus
    webpacker:verify_install
rake webpacker:install:svelte
    webpacker:verify_install
rake webpacker:install:typescript
    webpacker:verify_install
rake webpacker:install:vue
    webpacker:verify_install
rake webpacker:verify_install
    check_node
    check_yarn
    check_binstubs
rake webpacker:yarn_install
rake yarn:install
rake zeitwerk:check
    environment

我已尝试更新并重新安装 bundler 以查看是否有帮助,但问题仍然存在。我不知道是什么导致了这种情况。这也是我的佣金文件

require_relative "config/application"

Rails.application.load_tasks

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)