2013-08-24 2 views
1

내가 가드를 사용하여 자바 스크립트를 추하게하기 위해 노력하고있어하지만 난 다음 오류를 얻을 :가드 - 추하게은 "JSON 객체 또는 배열의 생성을 허용"던졌습니다

ERROR - Guard::Uglify failed to achieve its , exception was: [#] JSON::GeneratorError: only generation of JSON objects or arrays allowed [#] C:/Ruby193/lib/ruby/1.9.1/json/common.rb:216:in generate' [#] C:/Ruby193/lib/ruby/1.9.1/json/common.rb:216:in generate' [#] C:/Ruby193/lib/ruby/1.9.1/json/common.rb:352:in dump' [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:53:in block (2 levels) in compile' [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:51:in sub!' [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:51:in block in compile' [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:47:in tap' [#] C:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-2.0.0/lib/execjs/external_runtime.rb:47:in compile'

내가 JSON 2.0.0 (또한 시도를 사용하고 있습니다를 1.8.0) 및 System의 - JSON 1.7.8로 (또한

guard 'uglify', :destination_file => "js/scripts.min.js" do 
    watch 'js/scripts.min.js' 
end 
,536을 Guardfile

에서 1.7.9)

편집

코드를 시도

답변

1

이것은 자바 스크립트 코드가 올바르게 포맷되지 않은 상태로 연결되어야합니다.

오류가 발생한 위치를 찾을 수 없을 때까지 오류의 위치를 ​​알 수없는 경우 코드의 일부만 따로 따로 만들 수 있습니다.

+0

같은 일이 일어난다 "var에 A = 1;" – gr56

+0

다른 답변이 도움이 되었습니까? – NicoArbogast

+0

사실, 방금 Grunt로 전환했습니다. 어쨌든 당신의 도움에 감사 드리며 훨씬 쉽고 직관적입니다. – gr56

1

가드의 전화 번호를 알려주십시오.

Guard에 전달한 객체에 링크되어있을 수 있습니다. => 파일을 읽고 파싱해야합니다. 내가 빈 파일이나 같은 간단한 컴파일 할 때

JSON.parse(string or file read)