2016-11-12 58 views
1

所以我跑进以下问题:你的Ruby版本是2.3.1,但你的Gemfile指定2.3.1(版本相同)

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: 

是什么造成这个错误?

回答

3

woooooow,讨厌失败。

发现了问题:

我读了红宝石版本出来.ruby-version作为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的生成日志,这是真的很难看。

相关问题