2016-11-18 50 views
2

Heroku最近發生了一些變化。因爲我已經做了我不能部署我的應用程序之前:在Heroku上部署,如何指定用於捆綁器的ruby版本?

[email protected] my-project (master) $ git push staging master 
Counting objects: 52, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (51/51), done. 
Writing objects: 100% (52/52), 159.47 KiB | 0 bytes/s, done. 
Total 52 (delta 42), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote: 
remote: -----> Deleting 4 files matching .slugignore patterns. 
remote: -----> Ruby app detected 
remote: -----> Compiling Ruby/Rails 
remote: -----> Using Ruby version: ruby-2.3.0 
remote: -----> Installing dependencies using bundler 1.13.6 
remote:  Your app was upgraded to bundler 1.13.6. 
remote:  Previously you had a successful deploy with bundler 1.11.2. 
remote:   
remote:  If you see problems related to the bundler version please refer to: 
remote:  https://devcenter.heroku.com/articles/bundler-version 
remote:  Ruby version change detected. Clearing bundler cache. 
remote:  Old: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux] 
remote:  New: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] 
remote:  Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment 
remote:  Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0 
remote:  Bundler Output: Your Ruby version is 2.3.0, but your Gemfile specified 2.2.0 
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 my-project-staging. 
remote: 
To https://git.heroku.com/my-project-staging.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/my-project-staging.git' 

我不明白這一點,我使用ruby 2.2.0初起:

[email protected] my-project (master) $ ruby -v 
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14] 

[email protected] my-project (master) $ cat .ruby-version 
2.2.0 

[email protected] my-project (master) $ cat Gemfile | grep 'ruby' 
ruby '2.2.0' 

我不知道如何告訴捆綁器我仍然在使用ruby 2.2.0。我捆綁有這個底部:

RUBY VERSION 
    ruby 2.3.0p0 

BUNDLED WITH 
    1.12.1 

爲什麼捆綁不使用紅寶石2.2.0版本?它使用2.3.0代替...

+0

你是否在你的Gemfile中這麼說?我的意思是,你有一條線**'紅寶石'2.2.0'**明確地說? –

+0

[Heroku推送被拒絕,檢測到Ruby版本已更改,無法找到net-scp-1.0.6]的可能的重複(http://stackoverflow.com/questions/15033607/heroku-push-rejected-ruby-version-changed- detected-could-find-net-scp-1-0) – lcguida

+0

@EddeAlmeida當然,$ cat的結果Gemfile | grep'ruby''是'ruby'2.2.0''。 –

回答

3

檢查您的Gemfile.lock。 Bundler的最新版本添加了用於安裝gem(並生成Gemfile.lock)的ruby版本和bundler版本。

在底部,你會發現:

RUBY VERSION 
    ruby 2.3.0 

BUNDLED WITH 
    1.13.1 # or whatever version of bundler you're using 

刪除此,並重新運行bundle install與紅寶石的正確版本 - 您可能需要刪除+重新添加寶石觸發重新構建Gemfile.lock文件。

+0

我已經做了這個,但它總是2.3.0紅寶石版本。我不明白,我在每個地方都指定了2.2.0。 –

+0

您使用的是Ruby版本管理器嗎?確保你使用ruby 2.2.0運行'bundle install'。如果你使用'rvm',在運行'bundle'前運行'rvm use 2.2'。 – nburkley

+0

事實上,我使用'rbenv',但正如我貼在我的帖子中,我使用的本地版本的紅寶石是2.2.0 –

1

最後我添加刪除bundler並安裝與Heroku相同的版本。

相關問題