rake db:schema:dump无法正常工作

时间:2016-06-02 21:05:50

标签: ruby-on-rails rake

我正在Windows 8的Windows平台上学习ruby on rails 8.现在我在数据库部分,其中rake db:schema:dump命令应该在名为schema.rb的配置文件夹中创建一个文件,但这不会发生。当我输入rake db:schema:dump时,它会显示rake aborted和一个长列表。请帮忙。

以下是控制台中显示的内容:

C:\Users\New User\sites2\learning_rails>rake db:schema;dump
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'uglif
ier'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/r
ails/execjs for a list of available runtimes.
Backtrace for gem load error is:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in
 `autodetect'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:
ExecJS>'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (re
quired)>'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `requ
ire'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top
 (required)>'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:
in `require'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:
in `block (2 levels) in require'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:
in `each'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:
in `block in require'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:
in `each'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:
in `require'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.12.5/lib/bundler.rb:102:in `req
uire'
C:/Users/New User/sites2/learning_rails/config/application.rb:7:in `<top (requir
ed)>'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in
 `require'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in
 `require'
C:/Users/New User/sites2/learning_rails/Rakefile:4:in `<top (required)>'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in
 `load'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in
 `load_rakefile'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:689:i
n `raw_load_rakefile'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:94:in
 `block in load_rakefile'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:i
n `standard_exception_handling'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:93:in
 `load_rakefile'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:77:in
 `block in run'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:i
n `standard_exception_handling'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in
 `run'
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rake-11.1.2/bin/rake:33:in `<top (require
d)>'
C:/Ruby22-x64/bin/rake:22:in `load'
C:/Ruby22-x64/bin/rake:22:in `<main>'
Bundler Error Backtrace:
C:/Users/New User/sites2/learning_rails/config/application.rb:7:in `<top (requir
ed)>'
C:/Users/New User/sites2/learning_rails/Rakefile:4:in `<top (required)>'
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://git
hub.com/rails/execjs for a list of available runtimes.
C:/Users/New User/sites2/learning_rails/config/application.rb:7:in `<top (requir
ed)>'
C:/Users/New User/sites2/learning_rails/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

1 个答案:

答案 0 :(得分:0)

安装nodejs

Uglifier是JavaScript压缩器,因此需要javascript运行时尝试安装nodejs

apt-get install nodejs

brew install nodejs

如果你在OSX上。