2014-07-19 113 views
1

Gruntfile.js內容:致命錯誤:產卵ENOENT

grunt.initConfig({ 
     connect: { 
      server: { 
       options: { 
        port: 5005, 
        base: '.' 
       } 
      } 
     }, 
     qunit: { 
      all: ['test/*.html'] 
     } 
    }); 

grunt.loadNpmTasks('grunt-contrib-connect'); 
    grunt.loadNpmTasks('grunt-contrib-qunit'); 

grunt.registerTask('test', ['connect', 'qunit']); 

測試/ index.html文件內容:

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <title> 
      Sitejson - QUnit Test Runner 
     </title> 
     <link rel="stylesheet" href="libs/qunit/qunit.css" type="text/css"> 
    </head> 
    <body> 
     <div id="qunit"></div> 
     <div id="qunit-fixture"></div> 

     <script src="libs/qunit/qunit.js" type="text/javascript"></script> 
     <script src="testcases/tests.js" type="text/javascript"></script> 
    </body> 
</html> 

tests.js內容:

QUnit.test("hello test", function(assert) { 
    assert.ok(1 == "1", "Passed!"); 
}); 

我的工作在Ubuntu/Linux環境下。我也安裝了Phantomjs並且工作正常。每當我嘗試運行grunt測試時,我收到一個致命錯誤:spawn ENOENT錯誤。

而我嘗試運行它在瀏覽器的qunit工作正常...

我不能確定是什麼問題。我在這裏錯過了一些更多的配置。

咕嚕測試--debug顯示我:

Running "connect:server" (connect) task 
[D] Task source: /media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-connect/tasks/connect.js 
Started connect web server on http://0.0.0.0:5005 

Running "qunit:all" (qunit) task 
[D] Task source: /media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-qunit/tasks/qunit.js 
Testing test/index.html [D] ["/media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/phantomjs/main.js","/tmp/1405775714604.2773","test/index.html","{\"timeout\":5000,\"inject\":\"/media/hegdeashwin/Storage-TB/qunittesting/node_modules/grunt-contrib-qunit/phantomjs/bridge.js\",\"urls\":[],\"force\":false,\"console\":true,\"httpBase\":false}"] 
Fatal error: spawn EACCES 

回答