2015-12-22 12 views
103

Perché sto ricevendo questo errore?Si è verificato un errore durante il tentativo di caricare l'ugacle della gemma. (Bundler :: GemRequireError)

[email protected]:~/blog$ rails server 
/home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError) 
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require' 
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each' 
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require' 
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each' 
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require' 
    from /home/shibly/.gem/ruby/2.2.4/gems/bundler-1.11.2/lib/bundler.rb:99:in `require' 
    from /home/shibly/blog/config/application.rb:7:in `<top (required)>' 
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require' 
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server' 
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap' 
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server' 
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
    from /home/shibly/.gem/ruby/2.2.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>' 
    from bin/rails:9:in `require' 
    from bin/rails:9:in `<main> 
+0

avete risolto questo problema? Ho esattamente lo stesso problema. Sto eseguendo Ruby 2.2.4 con rails 4.2.5 su ubuntu. –

+2

prova sudo apt-get install nodejs – user3754535

risposta

222

È necessario eseguire seguente comando per installare NodeJS in Ubuntu

sudo apt-get install nodejs 

o eseguire questo per OSX

brew install nodejs 

Uglifier è un wrapper JS e ha bisogno di un tempo di esecuzione in esecuzione JS o JS interprete. Vorrei scegliere di installare NodeJS.

+4

perché ha bisogno di js env? – DragonKnight

+0

Grazie +1 dal futuro e ha funzionato –

+1

Funziona :) Grazie, Ma perché abbiamo bisogno di questo nodojs per essere installato? –

4

Penso che sia necessario il runtime JS. Prova ad installare nodejs.

28

Nel file di chiavi Rails predefinito, la linea per il "terubyracer" della gemma è commentata. Se disattivi, otterrai questa gemma e dovrebbe funzionare.

Da "Getting Started with Rails":

Compilazione CoffeeScript e JavaScript compressione patrimoniale richiede di avere un runtime JavaScript disponibile sul sistema, in assenza di un tempo di esecuzione si vedrà un errore durante la compilazione execjs patrimoniale. Di solito Mac OS X e Windows sono dotati di un runtime JavaScript installato. Rails aggiunge la gemma therubyracer allo Gemfile generato in una riga commentata per le nuove app e puoi decommentare se ne hai bisogno. therubyrhino è il runtime consigliato per gli utenti JRuby e viene aggiunto per impostazione predefinita allo Gemfile nelle app generate sotto JRuby. È possibile esaminare tutti i runtime supportati allo ExecJS.

+2

Grazie! Questo è stato più semplice e sembra più semplice che affidarsi a NodeJS. – ConnorWGarvey

+0

Questo ha funzionato anche per me –

+0

Mentre questa risposta funziona, elude che si dovrebbe preferibilmente avere (per la produzione) un runtime execjs corretto come node.js –

0

Si è verificato un errore durante la creazione del db.

Il problema è che i Node.js cercato di installare senza sudo nello script:

sudo apt-get install nodejs 
+0

Puoi spiegare ulteriormente? Forse mostrare una soluzione? –

Problemi correlati