Perché sto ricevendo questo errore?
[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 `' 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 `' from bin/rails:9:in `require' from bin/rails:9:in `
Dovresti eseguire il seguente comando per installare NodeJS in Ubuntu
sudo apt-get install nodejs
o eseguirlo per OSX
brew install nodejs
Uglifier è un wrapper JS e necessita di un runtime JS in esecuzione o di un interprete JS. Vorrei scegliere di installare NodeJS.
Nel file Gem di Rails predefinito, la linea per la gem “terubyracer” viene commentata. Se disattivi, otterrai questa gem e dovrebbe funzionare.
Da ” Guida introduttiva a Rails “:
Compilare CoffeeScript e la compressione delle risorse JavaScript richiede che sul proprio sistema sia disponibile un runtime JavaScript, in assenza di un runtime si vedrà un errore
execjs
durante la compilazione degli asset. Di solito Mac OS X e Windows sono dotati di un runtime JavaScript installato. Rails aggiunge la gem ditherubyracer
alGemfile
generato in una riga commentata per nuove app e puoi decommentare se ne hai bisogno.therubyrhino
è il runtime consigliato per gli utenti JRuby e viene aggiunto di default alGemfile
nelle app generate sotto JRuby. Puoi esaminare tutti i runtime supportati da ExecJS .
Si è verificato un errore durante la creazione del db.
Il problema è che Node.js ha provato a installare senza sudo
nello script:
sudo apt-get install nodejs