ruby-on-rails - 无法检测到 rake 任务确保您可以对您的应用运行“$ bundle exec rake -P”
问题描述
我一直在尝试运行 agit push heroku master
并且我继续收到以下错误:
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) - did find: [bundler-2.0.2]
remote: ! Checked in 'GEM_PATH=vendor/bundle/ruby/2.4.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)
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) - did find: [bundler-2.0.2]
remote: Checked in 'GEM_PATH=vendor/bundle/ruby/2.4.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: from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:961:in `rake'
remote: from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails4.rb:84:in `block (2 levels) in run_assets_precompile_rake_task'
remote: from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/base.rb:135:in `log'
我运行了上面建议的所有内容并继续收到错误消息。然后我按照本指南进行操作: 无法检测到 rake 任务
最新的一个,我开始收到此错误:
rvm install "ruby-2.6.3"
Warning, new version of rvm available '1.29.9-next', you are using older version '1.29.4'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.13/x86_64/ruby-2.6.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Updating Homebrew...
Error: undefined method `any?' for nil:NilClass
Please report this bug:
https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:216:in `depends_on'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:235:in `block in check_dependents'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:235:in `sort'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:235:in `check_dependents'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:114:in `upgrade'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'
Requirements installation failed with status: 1.
➜ dancortesPortfolio git:(master) ✗ gem install bundler '2.0.2'
Error loading RubyGems plugin "/Users/danale/.rvm/gems/ruby-2.4.0@global/gems/executable-hooks-1.3.2/lib/rubygems_plugin.rb": dlopen(/Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle
Reason: image not found - /Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle (LoadError)
Error loading RubyGems plugin "/Users/danale/.rvm/gems/ruby-2.4.0@global/gems/gem-wrappers-1.2.7/lib/rubygems_plugin.rb": dlopen(/Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle
Reason: image not found - /Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle (LoadError)
ERROR: Loading command: install (LoadError)
dlopen(/Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle
Reason: image not found - /Users/danale/.rvm/gems/ruby-2.4.0@global/gems/openssl-2.0.3/lib/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
解决方案
这不会解释您遇到的第二个错误,但是在您的第一个错误中,捆绑程序问题的一个可能解决方法是从文件中删除“BUNDLED WITH”行Gemfile.lock
。它们应该是文件的最后两行,并且(根据您的错误)应该类似于:
BUNDLED WITH
2.0.1
Gemfile.lock
每次运行时,这些行都会重新出现在文件中,bundle install
因此您需要在运行该命令后在推送到 heroku 时删除它们。我还没有找到更永久的解决方案,但这对我来说可以解决该错误。
推荐阅读
- azure - 为什么我的 Azure 容器实例几天后突然无法拉取镜像?
- react-native - React Native Linking eventListener 因深度链接而崩溃
- c++ - 我可以使用 Pimpl 提供 C++ 头文件,还是必须使用 C 内置类型进行展平?
- migration - 将 SSDT 从 2015 迁移到 2019 会破坏脚本组件
- css - 来自子组件的 Vue 3 插槽样式
- php - 如何使用教义订购?
- .net-core - 如何在 .NET Core 中使用安装项目 (vdproj) 的自定义操作
- javascript - 如何隐藏两个数组中的元素
- apache - 如何在 .htaccess 503 重定向中保持网站网址相同
- firebase - 重叠结果集的 Firestore 价格计算