2011-04-18 89 views
6

我在Rails 3.0應用程序上使用Ruby 1.9.2使用RVM。在heroku上通過bundler安裝linecache

which ruby 
/home/ved/.rvm/rubies/ruby-1.9.2-p136/bin/ruby 

,當我推到Heroku上,我得到以下錯誤:

Installing linecache19 (0.5.12) /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems 
installer.rb:164:in `install': linecache19 requires Ruby version >= 1.9.2(Gem::InstallError) 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start' 
    from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13 
    from /usr/ruby1.8.7/bin/bundle:19:in `load' 
    from /usr/ruby1.8.7/bin/bundle:19 
    FAILED: http://devcenter.heroku.com/articles/bundler 
    !  Heroku push rejected, failed to install gems via Bundler 

不知道這是爲什麼失敗,爲什麼使用紅寶石1.8.7 1.8寶石爲這個?

更新時間:

[email protected]:~/rails_projects/grabber$ which bundle 
/home/ved/.rvm/gems/[email protected]/bin/bundle 
[email protected]:~/rails_projects/grabber$ which rake 
/home/ved/.rvm/gems/[email protected]/bin/rake 
[email protected]:~/rails_projects/grabber$ which gem 
/home/ved/.rvm/rubies/ruby-1.9.2-p136/bin/gem 

我試着用1.9.2棧在Heroku上重新創建應用程序如下:

heroku create test-sushi-app --stack bamboo-mri-1.9.2 

現在我收到以下錯誤:

Installing linecache19 (0.5.12) with native extensions /usr/ruby1.9.2/lib/ruby/1.9.1 
/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to 
build gem native extension. (Gem::Installer::ExtensionBuildError)  
    /usr/ruby1.9.2/bin/ruby extconf.rb 
    checking for vm_core.h... no 
    checking for vm_core.h... no 
    Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz 
    Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz 
    *** extconf.rb failed *** 
    Could not create Makefile due to some reason, probably lack of 
    necessary libraries and/or headers. Check the mkmf.log file for more 
    details. You may need configuration options. 

    Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/ruby1.9.2/bin/ruby 
    --with-ruby-dir 
    --without-ruby-dir 
    --with-ruby-include 
    --without-ruby-include=${ruby-dir}/include 
    --with-ruby-lib 
    --without-ruby-lib=${ruby-dir}/lib 
    /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': Permission denied 
    /usr/ruby1.9.2/include/ruby-1.9.1/ruby-1.9.2-p180 (Errno::EACCES) 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:243:in `fu_mkdir' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:217:in `block (2 levels) in mkdir_p' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:215:in `reverse_each' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:215:in `block in mkdir_p' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:201:in `each' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p' 
    from /disk1/tmp/build_2q887zcrpytf9/.bundle/gems/ruby/1.9.1/gems/ruby_core_source 
    -0.1.5/lib/ruby_core_source.rb:59:in `block in create_makefile_with_core' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/tempfile.rb:320:in `open' 
    from /disk1/tmp/build_2q887zcrpytf9/.bundle/gems/ruby/1.9.1/gems/ruby_core_source- 
    0.1.5/lib/ruby_core_source.rb:51:in `create_makefile_with_core' 
    from extconf.rb:19:in `<main>' 


    Gem files will remain installed in /disk1/tmp/build_2q887zcrpytf9/.bundle/gems/ruby 
    /1.9.1/gems/linecache19-0.5.12 for inspection. 
    Results logged to /disk1/tmp/build_2q887zcrpytf9/.bundle/gems/ruby/1.9.1 
    /gems/linecache19-0.5.12/ext/trace_nums/gem_make.out 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in 
    build_extensions' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions' 
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler 
    /source.rb:95:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler 
    /installer.rb:55:in `block in run' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler 
    /spec_set.rb:12:in `block in each' 
from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler 
    /spec_set.rb:12:in `each' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start' 
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>' 
    from /usr/ruby1.9.2/bin/bundle:19:in `load' 
    from /usr/ruby1.9.2/bin/bundle:19:in `<main>' 
    FAILED: http://devcenter.heroku.com/articles/bundler 

! Heroku推拒絕,未能通過Bundler安裝寶石

+0

請出示'這bundle','這rake'和'這gem' – 2011-04-18 08:51:36

+2

這裏http://devcenter.heroku.com/articles/stack一看 - 它看起來像你在運行Heroku 1.8.7堆棧。你需要做一些事情,比如'heroku stack:migrate bamboo-mri-1.9.2'。 – matt 2011-04-18 09:03:22

+0

@vlad,更新了詳細的問題。 – Ved 2011-04-18 15:22:36

回答

8

感謝@matt和@brandon的幫助。這是我可以修復它的方式。

  1. 通過@馬特 - 重建應用程序與使用1.9.2:

    的Heroku創建測試壽司應用--stack竹MRI-1.9.2

  2. 設置以下環境變量:

    heroku上配置:添加BUNDLE_WITHOUT = 「發展:測試」 如在討論 - http://wesgibbs.me/post/1506018375/heroku-bundle-without-config-variable-wants-colons

  3. 改良的Gemfile包括紅寶石debug19條件:

    group :development, :test do if RUBY_VERSION =~ /1.9/ gem 'ruby-debug19' else gem 'ruby-debug' end end

7

是啊,我也面臨着同樣類型problem..I的只在寶石文件修改下面的語法和它的工作出來。非常感謝你們所有人。

group :development, :test do 
     if RUBY_VERSION =~ /1.9/ 
     gem 'ruby-debug19' 
     else 
     gem 'ruby-debug' 
     end 
    end