所以我遇到了以下问题:
Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1
在我部署应用程序时说Heroku。只有当您与当前的ruby版本和Gemfile的ruby版本不匹配时才会出现此错误。
您可以看到任何代码here
这是构建输出:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.1
remote: -----> Installing dependencies using bundler 1.11.2
remote: Ruby version change detected. Clearing bundler cache.
remote: Old: ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
remote: New: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1
remote: Bundler Output: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy....
remote:
remote: ! Push rejected to chatisto.
remote:
导致此错误的原因是什么?
答案 0 :(得分:4)
发现问题:
我从.ruby-version
读取了ruby版本,因为rbenv在执行rbenv local 2.3.1
时会生成此文件
。该文件在版本号后有一个中断。 (修正了here)
我用这段代码来读它:
ruby_version_file = File.expand_path(".ruby-version", __dir__)
ruby File.read(ruby_version_file)
File.read(ruby_version_file)
返回"2.3.1\n"
时...但是在heroku构建日志中,这很难看到。
答案 1 :(得分:0)
在Jenkins构建自动化中,我有完全相同的错误,但是在不同的上下文中。在我的情况下,解决方案是调用:
dplyr
调用现有代码行:rbenv rehash