首页 > 解决方案 > [phantomjs.launcher]:致命的 Windows 异常,代码 0xc0000005

问题描述

首先,这可能是来自PhantomJS has crashed 的重复问题 - 致命的 Windows 异常,代码 0xc0000005。我尝试了那里给出的解决方案,但它仍然不适合我

我建立了一个webpack 4 (4.16.5)项目karma 4.0.0(在我使用之前,karma 1.x.x但错误仍然相同)。自从我向项目中添加了更多单元测试(尽管没有太多测试用例)后,它就开始发生了。

所以这就是我运行测试时得到的结果(不是一直,例如如果我运行 10 次,它通常会工作 2-3 次)

PhantomJS 2.1.1 (Windows 8.0.0): Executed 0 of 37 SUCCESS (0 secs / 0 secs)
12 02 2019 14:01:09.798:ERROR [phantomjs.launcher]: Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

12 02 2019 14:01:09.910:ERROR [launcher]: PhantomJS crashed.
        Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

12 02 2019 14:01:09.910:ERROR [launcher]: PhantomJS stdout:

12 02 2019 14:01:09.911:ERROR [launcher]: PhantomJS stderr: Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

12 02 2019 14:01:09.915:INFO [launcher]: Trying to start PhantomJS again (1/2).
PhantomJS 2.1.1 (Windows 8.0.0) ERROR
  Disconnectedreconnect failed before timeout of 2000ms (transport error)
PhantomJS 2.1.1 (Windows 8.0.0): Executed 0 of 37 DISCONNECTED (5.91 secs / 0 secs)

我点击链接http://phantomjs.org/bug-reporting.html但找不到任何有价值的信息。

以下是我的内容karma.conf.ts

module.exports = function karmaConfig(config) {
    config.set({

        singleRun: true,

        frameworks: [
            'jasmine'
        ],

        files: [
            'sdk/**/*.spec.ts'
        ],

        preprocessors: {
            'sdk/**/*.spec.ts': ['webpack', 'sourcemap'],
            'sdk/**/!(*.spec).ts': ['coverage']
        },

        browsers: [
            'PhantomJS'
        ],

        reporters: [
            'progress',
            'coverage',
            'junit'
        ],

        coverageReporter: {
            dir: 'coverage/',
            reporters: [
                { type: 'text-summary' },
                { type: 'html' },
                {
                    type: 'lcov',
                    dir: 'reports',
                    subdir: 'coverage'
                }
            ]
        },

        junitReporter: {
            outputFile: 'reports/junit/TEST-karma.xml',
            useBrowserName: false
        },

        transports: ['polling'],

        webpack: require('./webpack.config'),

        webpackMiddleware: {
            stats: 'errors-only'
        },

        logLevel: config.LOG_INFO,

    });
};

非常感谢有关如何解决此问题的任何建议,这真的很烦人

标签: javascripttypescriptunit-testingkarma-jasminekarma-runner

解决方案


推荐阅读