我有一个Ruby on Rails和Redux / React应用程序,我已经通过“ git push heroku master”将数十次推送到heroku,并且它可以正确构建。我最近尝试创建一个临时环境。设置遥控器后,我运行
git push staging master
webpack部分正确构建,但是一旦Heroku尝试构建Rails部分,我就会收到此错误。
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) required by your /tmp/build_687b8b1cf6d6cbb297288640ccb0d405/Gemfile.lock.
remote: ! To update to the latest version installed on your system, run `bundle update --bundler`.
remote: ! To install the missing version, run `gem install bundler:2.0.1`
remote: ! Checked in 'GEM_PATH=vendor/bundle/ruby/2.5.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'`
要创建暂存环境,我运行
heroku create --remote staging
在项目的根文件夹中。
我也尝试过更新捆绑器。
bundle update --bundler
&
gem install bundler:2.0.1
我也尝试过预编译资产,但是什么也没有。
RAILS_ENV=production bundle exec rake assets:precompile
我跑了
bundle exec rake -P
如建议的那样,但这并不能解决问题。
另一件事是当我成功推送时,在日志中显示我正在使用其他红宝石版本
Using Ruby version: ruby-2.3.4
remote: -----> Installing dependencies using bundler 2.0.2
在登台日志中显示
Using Ruby version: ruby-2.5.5
remote: -----> Installing dependencies using bundler 2.0.2
不确定是否有帮助。但是任何可能的解决方案都可以帮助您!
谢谢!
答案 0 :(得分:0)
针对此类问题的解决方案,以确保所有环境(开发,登台,生产,CI)共享相同的Ruby版本。这将使开发和测试更加可预测。
在Gemfile中指定您的Ruby版本(此版本可与Ruby 2.3.4一起使用,因此我们将使用它):
# Gemfile
ruby '2.3.4'