2016-11-18 51 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相同的版本。

相关问题