2014-10-28 14 views
13

Sono stato Googling questo errore di seguito, ma non può risolvere questo errore:Ruby on Rails - Errore durante il bundle install

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. 

    /usr/bin/ruby2.1 extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h 

extconf failed, exit code 1 

Gem files will remain installed in /home/dyego/.bundler/tmp/9200/gems/sqlite3-1.3.9 for inspection. 
Results logged to /home/dyego/.bundler/tmp/9200/extensions/x86_64-linux/2.1.0/sqlite3-1.3.9/gem_make.out 
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue. 
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling. 
     run bundle exec spring binstub --all 
/usr/lib/ruby/vendor_ruby/bundler/resolver.rb:296:in `resolve': Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound) 
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:168:in `start' 
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:129:in `block in resolve' 
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:128:in `catch' 
    from /usr/lib/ruby/vendor_ruby/bundler/resolver.rb:128:in `resolve' 
    from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:179:in `resolve' 
    from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:114:in `specs' 
    from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:159:in `specs_for' 
    from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:148:in `requested_specs' 
    from /usr/lib/ruby/vendor_ruby/bundler/environment.rb:18:in `requested_specs' 
    from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:13:in `setup' 
    from /usr/lib/ruby/vendor_ruby/bundler.rb:120:in `setup' 
    from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:17:in `<top (required)>' 
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require' 

Così ho Googled questo errore:

mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

e ho alcune domande simili come questo: Error while installing json gem 'mkmf.rb can't find header files for ruby'

Ma ho già installato ruby-dev:

sudo apt-get install ruby-dev 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
ruby-dev is already the newest version. 
0 upgraded, 0 newly installed, 0 to remove and 72 not upgraded. 

Sto davvero lottando per risolvere questo problema (anche se sembra essere semplice).

+0

hai provato a installare 'sudo apt-get install ruby2.1-dev'? – Alireza

+0

cosa succede quando si esegue 'gem install sqlite3 -v '1.3.9''? – Anthony

+2

Usa 'rvm'. Non mettere Ruby nel tuo ambiente, dal momento che probabilmente lavorerai con diverse versioni di Ruby nei tuoi progetti. – blelump

risposta

38

tenta di installare la libreria ruby-dev per la versione di Ruby che è 2,1

$ sudo apt-get install ruby2.1-dev 
+2

Se sei pigro e non è un sistema di produzione, basta installare 'ruby-dev' anche per il trucco. E sì, mi rendo conto che è divertente che sto mettendo più impegno in questo commento di quello che mi avrebbe richiesto per digitare i 3 caratteri in più necessari per la specificità della versione. Do la colpa alla società. –

+0

A questo punto dovrebbe essere 'ruby-2.3-dev'. Puoi capire il nome del pacchetto eseguendo 'apt-cache search 'ruby. * - dev" 'se sei su una distribuzione basata su Debian (ad esempio Ubuntu, Mint). – einpoklum

3

Had errore simile su Fedora quando si tenta di installare la bussola per lo sviluppo SASS

gem install compass 

riuscita con

Creazione di estensioni native. Questo potrebbe richiedere del tempo ... ERRORE: Errore durante l'installazione della bussola: ERRORE: impossibile creare l'estensione nativa gemma.

/usr/bin/ruby ​​extconf.rb mkmf.rb non riesce a trovare i file di intestazione per Ruby a /usr/share/include/ruby.h

Ran questo

yum -y install gcc ruby-devel rubygems 

e quindi è stato in grado di eseguire nuovamente l'installazione con successo.

+0

Ricevo 'Nessun pacchetto ruby-devel disponibile. Quando si esegue' yum -y installa ruby-devel'. C'è un nuovo pacchetto da installare? –

+0

Questa è la risposta che mi ha aiutato quando stavo cercando di installare la bussola. Tuttavia, i rubygems non erano necessari. Ho appena usato sudo yum install ruby-devel gcc -y –

Problemi correlati