Page 106 of 165

Rails 3.1 beta rc2 – Could not find a JavaScript runtime

Uruchamiając aplikację na Railsach 3.1beta rc2 możemy dostać taki błąd:

.rvm/gems/ruby-1.9.2-head@gems/execjs-1.1.1/lib/execjs/runtimes.rb:43:
in `autodetect': Could not find a JavaScript runtime. 
See https://github.com/sstephenson/execjs for a list of available runtimes.
(ExecJS::RuntimeUnavailable)

Rozwiązanie jest bardzo proste, dodajemy therubyracer do gemfilea:

gem 'therubyracer'

odpalamy:

bundle install

i problem znika :)

 

Global access to Rake DSL methods is deprecated – mały zgrzyt z Rake 0.9.0 i 0.9.1

Przechodząc na rake 0.9.1 możecie napotkać na taki (lub podobny) komunikat podczas odpalania zadań rake'owych na Railsowej aplikacji:

WARNING: Global access to Rake DSL methods is deprecated.  Please Include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Susanoo::Application
#task called at /sciezka/rails/application.rb:215:in `initialize_tasks'

Rozwiązania są dwa. Pierwszym z nich jest powrót do 0.8.7:

sudo gem install rake -v 0.8.7
gem 'rake', '0.8.7'

Drugim jest dołączenie Rake::DSL do naszej aplikacji:

require 'rake'

module MyApp
  class Application < Rails::Application
    include Rake::DSL
    # dalsza część
  end
end

Copyright © 2024 Closer to Code

Theme by Anders NorenUp ↑