0

我刚刚在我的 Windows 7 上安装了 railsinstaller。我在 C:/Sites 中创建了一个 sample_app 文件夹。我用“gem update”更新了所有内容。当我想启动服务器时,出现以下错误:

Lanti@LANTI-PC /c/Sites/sample_app
$ rails s
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.1/lib/execjs/run
times.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://gi
thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn
available)
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:ExecJS>'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `require'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `<top (required)>'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:in `require'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:72:in `each'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:72:in `block in require'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:61:in `each'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:61:in `require'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.7.3/lib/bundler.rb:133:in `require'
    from c:/Sites/sample_app/config/application.rb:7:in `<top (required)>'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
Lanti@LANTI-PC /c/Sites/sample_app
$

这是我安装的 gem 的列表:

Lanti@LANTI-PC /c/Sites/sample_app
$ gem update
Updating installed gems
Nothing to update
Lanti@LANTI-PC /c/Sites/sample_app
$ gem list

*** LOCAL GEMS ***

actionmailer (4.1.6, 4.0.0, 3.2.14)
actionpack (4.1.6, 4.0.0, 3.2.14)
actionview (4.1.6)
activemodel (4.1.6, 4.0.0, 3.2.14)
activerecord (4.1.6, 4.0.0, 3.2.14)
activerecord-deprecated_finders (1.0.3)
activerecord-sqlserver-adapter (4.1.0, 3.2.12)
activeresource (4.0.0, 3.2.14)
activesupport (4.1.6, 4.0.0, 3.2.14)
arel (5.0.1.20140414130214, 4.0.2, 3.0.2)
atomic (1.1.16, 1.1.10)
bigdecimal (1.2.5, 1.2.0)
builder (3.2.2, 3.1.4, 3.0.4)
bundler (1.7.3, 1.3.5)
coffee-rails (4.0.1, 4.0.0)
coffee-script (2.3.0, 2.2.0)
coffee-script-source (1.8.0, 1.6.3)
erubis (2.7.0)
execjs (2.2.1, 1.4.0)
hike (2.1.3, 1.2.3)
i18n (0.6.11, 0.6.4)
io-console (0.4.2)
jbuilder (2.1.3, 1.5.3)
journey (1.0.4)
jquery-rails (3.1.2, 3.0.4)
json (1.8.1, 1.7.7)
mail (2.6.1, 2.5.4)
mime-types (2.3, 1.25.1, 1.23)
minitest (5.4.1, 4.7.5, 4.3.2)
multi_json (1.10.1, 1.7.7)
pg (0.17.1 x86-mingw32, 0.16.0 x86-mingw32)
polyglot (0.3.5, 0.3.3)
power_assert (0.1.3)
psych (2.0.6, 2.0.0)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.4.1, 1.3.3)
rack-test (0.6.2)
rails (4.1.6, 4.0.0)
rails-observers (0.1.2)
railties (4.1.6, 4.0.0)
rake (10.3.2, 0.9.6)
rb-readline (0.5.1, 0.5.0)
rdoc (4.1.2, 4.0.0)
rubyzip (1.1.6, 0.9.9)
sass (3.4.5, 3.2.19, 3.2.9)
sass-rails (4.0.3, 4.0.0)
sdoc (0.4.1)
sprockets (2.12.2, 2.11.0, 2.10.0, 2.2.2)
sprockets-rails (2.1.4, 2.0.1, 2.0.0)
sqlite3 (1.3.9 x86-mingw32, 1.3.7 x86-mingw32)
sqlite3-ruby (1.3.3)
test-unit (3.0.1, 2.0.0.0)
thor (0.19.1, 0.18.1)
thread_safe (0.3.4, 0.1.2)
tilt (2.0.1, 1.4.1)
tiny_tds (0.6.2 x86-mingw32, 0.6.1 x86-mingw32)
treetop (1.5.3, 1.4.15, 1.4.14)
turbolinks (2.3.0)
tzinfo (1.2.2, 0.3.41, 0.3.37)
uglifier (2.5.3)
Lanti@LANTI-PC /c/Sites/sample_app

谢谢您的帮助!

4

2 回答 2

1

将此添加到您的 Gemfile

gem 'therubyracer', :platforms => :ruby

bundle install
于 2014-09-23T08:11:26.533 回答
0
gem "execjs"
gem "therubyracer"

在这里查看更多

于 2014-09-23T08:07:19.753 回答