Heroku Ruby版本不会升级? [英] Heroku Ruby version won't upgrade?
问题描述
我使用Ruby 2.0.0和rails 4。
我的Gemfile有:
source'https://rubygems.org'
ruby'2.0.0'
...
Heroku中的路径指向:
$ heroku config -s | grep PATH
PATH = bin:vendor / bundle / ruby / 1.9.1 / bin:/ usr / local / bin:/ usr / bin:/ bin
当我推送我的应用时,我可以看到:
提取储存库,完成。
计数对象:7,完成。
使用多达4个线程的增量压缩。
压缩对象:100%(4/4),完成。
写入对象:100%(4/4),431字节| 0字节/秒,完成。
共计4(delta 3),重用0(delta 0)
-----> Ruby应用检测到
----->编译Ruby / Rails
----->使用Ruby版本:ruby-2.0.0
----->使用Bundler版本1.3.2安装依赖项
运行:bundle安装 - 无需开发:test --path vendor / bundle --binstubs vendor / bundle / bin --deployment
使用rake(10.1.1)
使用i18n(0.6.9)
使用minitest(4.7.5)
使用multi_json(1.8.2)
使用原子(1.1.14)
使用thread_safe (0.1.3)
使用tzinfo(0.3.38)
使用activesupport(4.0.0.rc1)
使用构建器(3.1.4)
使用erubis(2.7.0 )
使用rack(1.5.2)
使用rack-test(0.6.2)
使用actionpack(4.0.0.rc1)
使用MIME类型(1.25.1 )
使用polyglot(0.3.3)
使用treetop(1.4.15)
使用邮件(2.5.4)
使用actionmailer(4.0.0.rc1)
使用activemodel(4.0.0.rc1)
使用activerecord-deprecated_finders(1.0.3)
使用arel(4.0.1)
使用activerecord(4.0.0.rc1)
使用可寻址(2.3.5)
使用bcrypt-ruby(3.1.2)
使用coffee-script-source(1.6.3)
使用execjs(2.0.2)
使用coffee-script(2.2.0)
使用thor(0.18.1)
使用railties(4.0.0.rc1)
使用咖啡栏(4.0.0)
使用orm_adapter(0.5.0)
使用warden(1.2.3)
使用devise(3.0.4)
使用excon(0.25.3)
使用地理编码器(1.1.9) )
使用gmapsjs(0.2.30.1)
使用heroku-api(0.3.15)
使用launchy(2.4.2)
使用netrc(0.7.7)
使用rest-client(1.6.7)
使用rubyzip(1.1.0)
使用heroku(3.2.1)
使用远足(1.2.3)
使用jbuilder 1.0.2)
使用jquery-rails(3.0.4)
使用jquery-ui-rails(4.1.1)
使用json(1.8.1)
使用libv8 3.16.14.3)
使用漂亮生成器(0.4.6)
使用pg(0 .17.1)
使用bundler(1.3.2)
使用倾斜(1.4.1)
使用链轮(2.10.1)
使用sprockets-rails(2.0.1)
使用rails(4.0.0.rc1)
使用rails_serve_static_assets(0.0.2)
使用rails_stdout_logging(0.0.3)
使用rails_12factor(0.0.2)
使用rails rdoc(3.12.2)
使用ref(1.0.5)
使用sass(3.2.13)
使用sass-rails(4.0.0)
使用sdoc(0.3。 20)
使用therubyracer(0.12.0)
使用turbolinks(2.1.0)
使用uglifier(2.4.0)
使用will_paginate(3.0.5)
你的包已经完成了!它已安装到./vendor/bundle
捆绑已完成(0.46s)
清理捆绑缓存。
移除rails_log_stdout(01b5bcc572e3)
移除rails3_serve_static_assets(84910ceb4ca2)
----->编写config / database.yml以从DATABASE_URL读取
----->为Rails资产管道准备应用程序
运行:rake资产:预编译
资产预编译完成(3.59s)
清理资产
----->发现过程类型
Procfile声明类型 - > (无)
Ruby的默认类型 - >控制台,耙,网络,工人
----->压缩...完成,33.3MB
----->启动...完成,v17
http://rocky-shore-1207.herokuapp.com部署到Heroku
到git@heroku.com:rocky-shore-1207.git
05cf948..73b6cfa master - > master
由于Heroku表示使用Ruby版本:ruby-2.0.0
,它检测到我的Ruby版本。
然而,当我运行 $ heroku运行rake db:migrate
或 heroku run'ruby -v'
它返回:
您的Ruby版本是1.9.2,但您的Gemfile指定为2.0.0
如何在Heroku上将Ruby版本更改为2.0.0?
结论:
我注意到我的rails应用程序有.bash_profile文件,但它有一个错误的路径。这条路径扰乱了我的Heroku版本的红宝石路径。
感谢大家的帮助:)
在本地执行: bundle update
然后提交文件 Gemfile.lock
?
服务器正在使用Ruby 2,但如果新的锁定文件未被推送,应用程序仍旧配置为使用旧版本。
检查运行版本:
$ heroku run console
> RUBY_VERSION
如果版本是正确的,您指定的版本,那么您的捆绑器问题。
gem install bundler
我推荐一个完整且干净的构建:
bundle clean --force
gem install bundler
bundle install
I am struggling changing Ruby versions on Heroku. I use Ruby 2.0.0 with rails 4.
My Gemfile has:
source 'https://rubygems.org'
ruby '2.0.0'
...
The path in Heroku points to:
$ heroku config -s | grep PATH
PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
When I pushed my app, I could see:
Fetching repository, done.
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 431 bytes | 0 bytes/s, done.
Total 4 (delta 3), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.0.rc1)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0.rc1)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0.rc1)
Using activemodel (4.0.0.rc1)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.0.rc1)
Using addressable (2.3.5)
Using bcrypt-ruby (3.1.2)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0.rc1)
Using coffee-rails (4.0.0)
Using orm_adapter (0.5.0)
Using warden (1.2.3)
Using devise (3.0.4)
Using excon (0.25.3)
Using geocoder (1.1.9)
Using gmapsjs (0.2.30.1)
Using heroku-api (0.3.15)
Using launchy (2.4.2)
Using netrc (0.7.7)
Using rest-client (1.6.7)
Using rubyzip (1.1.0)
Using heroku (3.2.1)
Using hike (1.2.3)
Using jbuilder (1.0.2)
Using jquery-rails (3.0.4)
Using jquery-ui-rails (4.1.1)
Using json (1.8.1)
Using libv8 (3.16.14.3)
Using nifty-generators (0.4.6)
Using pg (0.17.1)
Using bundler (1.3.2)
Using tilt (1.4.1)
Using sprockets (2.10.1)
Using sprockets-rails (2.0.1)
Using rails (4.0.0.rc1)
Using rails_serve_static_assets (0.0.2)
Using rails_stdout_logging (0.0.3)
Using rails_12factor (0.0.2)
Using rdoc (3.12.2)
Using ref (1.0.5)
Using sass (3.2.13)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using therubyracer (0.12.0)
Using turbolinks (2.1.0)
Using uglifier (2.4.0)
Using will_paginate (3.0.5)
Your bundle is complete! It was installed into ./vendor/bundle
Bundle completed (0.46s)
Cleaning up the bundler cache.
Removing rails_log_stdout (01b5bcc572e3)
Removing rails3_serve_static_assets (84910ceb4ca2)
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (3.59s)
Cleaning assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby -> console, rake, web, worker
-----> Compressing... done, 33.3MB
-----> Launching... done, v17
http://rocky-shore-1207.herokuapp.com deployed to Heroku
To git@heroku.com:rocky-shore-1207.git
05cf948..73b6cfa master -> master
Since Heroku said Using Ruby version: ruby-2.0.0
, it detected my Ruby version.
However, when I run $ heroku run rake db:migrate
or heroku run 'ruby -v'
it returned:
Your Ruby version is 1.9.2, but your Gemfile specified 2.0.0
How can I change the Ruby version to 2.0.0 on Heroku?
Conclusion: I noticed my rails app had .bash_profile file but it had a wrong path. The path disturbed my heroku path for the ruby version.
Thank you for the help everyone :)
Did you execute: bundle update
locally and then committed the file Gemfile.lock
?
The server is using Ruby 2, but the app is still configured to use the old version if the new lock file is not pushed.
Review the running version:
$ heroku run console
> RUBY_VERSION
If the version is correct, the one you specified, then you have a bundler problem. Just reinstall it.
gem install bundler
I recommend a full and clean build:
bundle clean --force
gem install bundler
bundle install
这篇关于Heroku Ruby版本不会升级?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!