致命错误:产生ENOENT

时间:2014-07-19 13:18:02

标签: phantomjs qunit spawn enoent grunt-contrib-qunit

Gruntfile.js内容:

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']);

Test / 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测试时,我都会收到致命错误:产生ENOENT错误。

虽然我尝试在浏览器上运行它的qunit工作正常......

我无法确定问题所在。我在这里错过了一些配置。

grunt测试--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

1 个答案:

答案 0 :(得分:1)

使用以下过程:

  • 设置tmpdir环境变量:

    setenv TMPDIR=~/tmp
    
  • 重新运行grunt任务

  • 如果有效,请通过将以下内容添加到.bashrc.profile来永久设置:

    export TMPDIR=~/tmp
    

<强>参考

相关问题