2016-11-12 76 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的生成日誌,這是真的很難看。

相關問題