刚开始运行Guard,我遇到了一个奇怪的问题。一旦我添加了多个文件来连接和 uglify --- uglifier 就会继续触发。我必须按 ^C 让它停止,这会引发以下错误:
ERROR - Guard::Uglify failed to achieve its <run_on_change>, exception was:
ExecJS::RuntimeError:
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:142:in `exec_runtime'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/uglifier-1.3.0/lib/uglifier.rb:100:in `compile'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-uglify-0.1.0/lib/guard/uglify.rb:23:in `run_on_change'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:99:in `block in run_supervised_task'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:97:in `catch'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:97:in `run_supervised_task'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:146:in `block in run_first_task_found'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:144:in `each'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:144:in `run_first_task_found'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:79:in `block in run_on_changes'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:175:in `block (3 levels) in scoped_guards'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:174:in `each'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:174:in `block (2 levels) in scoped_guards'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:173:in `catch'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:173:in `block in scoped_guards'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:172:in `each'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:172:in `scoped_guards'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard/runner.rb:72:in `run_on_changes'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard.rb:141:in `block (2 levels) in setup_listener'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard.rb:365:in `block in within_preserved_state'
<internal:prelude>:10:in `synchronize'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard.rb:362:in `within_preserved_state'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/guard-1.7.0/lib/guard.rb:140:in `block in setup_listener'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/listener.rb:212:in `call'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/listener.rb:212:in `on_change'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/listener.rb:221:in `block in initialize_adapter'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/adapter.rb:198:in `call'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/adapter.rb:198:in `report_changes'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/adapter.rb:210:in `poll_changed_dirs'
/Users/joe/.rvm/gems/ruby-1.9.3-p194/gems/listen-0.7.3/lib/listen/adapters/darwin.rb:38:in `block in start'
请注意,代码仍然被正确挖掘并且一切正常......但是一旦我点击 ^C uglify 就不会再次触发。就像我说的,我是 Guard 的新手,所以我不知道我是否做错了什么,这是 Guard-uglify 的错误还是 Ruby 的错误,或者只是 Guard 本身的错误。
几点注意事项:
- 是的,所有宝石都是最新的
- 红宝石 1.9.3
- Mac OSX 10.8.3
另外,这是我的 Guardfile:
guard :concat, type: "js", files: %w(vendor/jquery-1.9.1.min vendor/handlebars vendor/jquery.iosslider.min app), input_dir: "js", output: "js/s.min"
guard 'uglify', :destination_file => "js/s.min.js" do
watch (%r{js/s.min.js})
end
非常感谢任何帮助