2012-03-25 12 views
7

Znalazłem wiele postów na ten sam temat (here's) i uważam, że wprowadziłem odpowiednie zmiany, ale nadal nie mogę rozwiązać problemu.Wdrażanie RoR na Heroku i Sqlite3 kończy się niepowodzeniem

Po zakończeniu instalacji pakietu, wysyłam do heroku, pojawia się następujący błąd po dojściu do instalacji sqlite3.

Installing sqlite3 (1.3.5) with native extensions 
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 
    /usr/local/bin/ruby extconf.rb 
    checking for sqlite3.h... no 
    sqlite3.h is missing. Try 'port install sqlite3 +universal' 
    or 'yum install sqlite-devel' and check your shared library search path (the 
    location where your sqlite3 shared library is located). 
    *** 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/local/bin/ruby 
    --with-sqlite3-dir 
    --without-sqlite3-dir 
    --with-sqlite3-include 
    --without-sqlite3-include=${sqlite3-dir}/include 
    --with-sqlite3-lib 
    --without-sqlite3-lib=${sqlite3-dir}/lib 
    --enable-local 
    --disable-local 
    Gem files will remain installed in /tmp/build_13nbwv3kitbub/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection. 
    Results logged to /tmp/build_13nbwv3kitbub/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out 
    An error occured while installing sqlite3 (1.3.5), and Bundler cannot continue. 
    Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling. 
! 
!  Failed to install gems via Bundler. 
! 
!  Heroku push rejected, failed to compile Ruby/rails app 

To [email protected]:morning-dawn-1372.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:morning-dawn-1372.git' 

My Gemfile wygląda następująco:

source 'https://rubygems.org' 

gem 'rails', '3.2.2' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'json' 

group :development, :test do 
    gem 'sqlite3-ruby', :require => 'sqlite3' 
    gem 'sqlite3', '1.3.5' 
end 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    # gem 'therubyracer' 

    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

group :production do 
    gem 'pg', '0.12.2' 
end 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug' 

wygląda mam zarówno

Using sqlite3 (1.3.5) 
Using sqlite3-ruby (1.3.3) 

na moim systemie. Nie jestem pewien, czy to problem, ale wyjaśnia, dlaczego wykluczyłem oba w gemfile.

Informacje dotyczące środowiska naturalnego:

$ ruby -v 
ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-cygwin] 

$ rails -v 
Rails 3.2.2 

Odpowiedz

12

Uruchom komendę bundle a następnie upewnij się, że zarówno Gemfile i Gemfile.lock są sprawdzane pod repo przed popychanie do Heroku.

+0

Po uruchomieniu Instalacji pakietu nie są wyświetlane żadne Gemfile ani Gemfile.lock. – glennm

+2

Ok, więc zapomniałem dodać pliki do repo przed naciśnięciem. Problem rozwiązany (błąd debiutanta), dziękuję! – glennm

1

Otrzymasz również ten błąd jeśli SQLite jest określona w Gemfile bez Grupy- np

gem 'rails', '3.2.13' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

# below is the line that's giving you trouble  
gem "sqlite3", "~> 1.3.7" 

Heroku nie pozwala SQLite w produkcji, więc trzeba albo usunąć tę linię lub zmienić na coś jak

... 
group :development, :test do 
    gem "sqlite3", "~> 1.3.7", :require => "sqlite3" 
end 

następnie zrobić bundle install, następnie git add i git commit zmiany do Gemfile i Gemfile.lock.

Po wykonaniu tej czynności urządzenie git push heroku master powinno działać.

1

Spróbuj tego:

  • Otwórz Gemfile.lock i przejdź do sqlite3 (1.3.x) pod tytułem 'Specyfikacja:'
  • Upewnij się, że pojawia się tylko jako sqlite3 (1.3.x) bez dodatkowy jazz.
  • Jeśli pojawią się dodatkowe znaczniki, takie jak "-x86-mingw32", usuń je.
  • Uruchom instalację pakietu.
  • Następnie spróbuj pchnąć mistrza Heroku.

Pracowałem dla mnie.

Edit

Teraz wiem, że lepiej, proszę nie zawsze ręcznie zmienić Gemfile.lock. Zostało to napisane, gdy zacząłem kodować w Railsach w systemie Windows. Spróbuj zaktualizować konkretny klejnot lub zablokuj go do wersji w Gemfile.

Powiązane problemy