I run a bunch of Jasmine specs with PhantomJS (via Grunt) on a Windows 7 PC, and I happen to get the following error:
我在Windows 7电脑上运行了一串带有幻影的茉莉花规格(通过咕哝),我碰巧得到了以下错误:
Testing jasmine specs via phantom
......
Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.
Aborted due to warnings.
The error does not appear if I delete a bunch of tests; however I have no idea what causes the error.
如果我删除了一堆测试,错误就不会出现;但是我不知道是什么引起了这个错误。
What I also find strange, it that it only occurs now and then.
我也发现奇怪的是,它只是偶尔发生。
Any idea why this happens?
知道为什么会这样吗?
5 个解决方案
#1
2
We are running AngularJS tests via jasmine and grunt, and had this very same problem. For us it turned out to be due to our custom $exceptionHandler function.
我们正在通过jasmine和grunt运行AngularJS测试,并且遇到了同样的问题。对我们来说,这是由于我们的自定义$exceptionHandler函数。
We were missing the throw exception
line that is in the example handler. By not throwing the exception, the test would pass but it would randomly cause PhantomJS to crash.
我们错过了示例处理程序中抛出的异常行。通过不抛出异常,测试将通过,但它将随机导致PhantomJS崩溃。
This means that some of our tests were failing and we didn't know it!
Here's the sample handler from the $exceptionHandler documentation page:
这是来自$exceptionHandler文档页面的示例处理程序:
angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
return function (exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception; // <--- This is important
};
});
So I'd look and see if you have custom exception handling too and are possibly missing the throw exception
line. I hope it's as simple as that for you too!
因此,我将查看是否有自定义异常处理,并可能错过抛出异常行。我希望对你来说也一样简单!
#2
2
(Sadly, I don't have an answer. I would post as a comment, but I don't have the rep.)
很遗憾,我没有答案。我会发表评论,但我没有代表)
I'm getting the same error trying to create html snapshots with grunt-html-snapshot.
我在使用grunt-html-snapshot创建html快照的过程中遇到了同样的错误。
Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.
Aborted due to warnings.
I'm feeding grunt a list of URLs and I "randomly" get this crash somewhere in the list. I think I have traced it to the child process spawn call that launches phantom.exe with the bridge.js script. It doesn't seem to get as far as trying load the next page before the phantom.exe child process exits with the error. I haven't been able to find any documentation on the error code.
我正在给grunt一个url列表,我“随机”地把这个崩溃放到列表的某个地方。我想我已经将它追溯到启动phantom的子进程衍生调用。exe的桥。js脚本。它似乎没有在幻影之前加载下一页那么远。exe子进程以错误退出。我没有找到任何关于错误代码的文档。
#3
0
I received the same error message as Helge after renaming a folder and running jasmine in grunt.
在重命名一个文件夹并在grunt中运行jasmine之后,我收到了与Helge相同的错误信息。
The folder contained all the JavaScript files I wanted to minify into one file, and I renamed the folder to match the final file name. For example the folder, \src\modules\
was renamed \src\modules.js\
.
这个文件夹包含了我想要缩小成一个文件的所有JavaScript文件,我将文件夹重命名为匹配最终文件名。例如文件夹,\src\module被重命名为\src\modules.js\。
Removing .js from the folder name solved the problem.
从文件夹名中删除.js解决了这个问题。
#4
0
Using PhantomJS to generate snapshots for AngularJS.
使用PhantomJS为AngularJS生成快照。
The snapshots script goes through an array of urls of which it has to take snapshots.
快照脚本通过一个url数组,必须对其进行快照。
Narrowed down to the possible cause and as it turned out there was a bug in my latest fix in AngularJS. This bug resulted in the constantly switching the home page and the page where the error occurred.
我把范围缩小到可能的原因,结果发现我最新修复的AngularJS中有一个bug。这个错误导致不断地切换发生错误的主页和页面。
Code Visualization:
代码可视化:
$state.go('home state');
...
$state.go('an other state');
...
$state.go('home state');
...
$state.go('an other state');
...
$state.go('home state');
...
...
=> Error: PhantomJS exited unexpectedly with exit code -1073741819
In short:
简而言之:
For me this error was caused by an infinite redirect loop.
对我来说,这个错误是由一个无限重定向循环引起的。
#5
-1
The warning PhantomJS exited unexpectedly with exit code -1073741819
is also displayed when your local PhantomJS is incompatible or corrupt.
当您的本地PhantomJS不兼容或损坏时,也会显示带有出口代码-1073741819的意外发出的警告显象。
With npm list -g phantomjs
you can check your PhantomJS version.
使用npm列表-g phantomjs可以检查你的phantomjs版本。
If you think that it is corrupt, just reinstall it with:
如果您认为它是腐败的,只需重新安装:
npm uninstall phantomjs -g
npm install phantomjs -g
#1
2
We are running AngularJS tests via jasmine and grunt, and had this very same problem. For us it turned out to be due to our custom $exceptionHandler function.
我们正在通过jasmine和grunt运行AngularJS测试,并且遇到了同样的问题。对我们来说,这是由于我们的自定义$exceptionHandler函数。
We were missing the throw exception
line that is in the example handler. By not throwing the exception, the test would pass but it would randomly cause PhantomJS to crash.
我们错过了示例处理程序中抛出的异常行。通过不抛出异常,测试将通过,但它将随机导致PhantomJS崩溃。
This means that some of our tests were failing and we didn't know it!
Here's the sample handler from the $exceptionHandler documentation page:
这是来自$exceptionHandler文档页面的示例处理程序:
angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
return function (exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception; // <--- This is important
};
});
So I'd look and see if you have custom exception handling too and are possibly missing the throw exception
line. I hope it's as simple as that for you too!
因此,我将查看是否有自定义异常处理,并可能错过抛出异常行。我希望对你来说也一样简单!
#2
2
(Sadly, I don't have an answer. I would post as a comment, but I don't have the rep.)
很遗憾,我没有答案。我会发表评论,但我没有代表)
I'm getting the same error trying to create html snapshots with grunt-html-snapshot.
我在使用grunt-html-snapshot创建html快照的过程中遇到了同样的错误。
Running PhantomJS...ERROR
>> 0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code -1073741819. Use --force to continue.
Aborted due to warnings.
I'm feeding grunt a list of URLs and I "randomly" get this crash somewhere in the list. I think I have traced it to the child process spawn call that launches phantom.exe with the bridge.js script. It doesn't seem to get as far as trying load the next page before the phantom.exe child process exits with the error. I haven't been able to find any documentation on the error code.
我正在给grunt一个url列表,我“随机”地把这个崩溃放到列表的某个地方。我想我已经将它追溯到启动phantom的子进程衍生调用。exe的桥。js脚本。它似乎没有在幻影之前加载下一页那么远。exe子进程以错误退出。我没有找到任何关于错误代码的文档。
#3
0
I received the same error message as Helge after renaming a folder and running jasmine in grunt.
在重命名一个文件夹并在grunt中运行jasmine之后,我收到了与Helge相同的错误信息。
The folder contained all the JavaScript files I wanted to minify into one file, and I renamed the folder to match the final file name. For example the folder, \src\modules\
was renamed \src\modules.js\
.
这个文件夹包含了我想要缩小成一个文件的所有JavaScript文件,我将文件夹重命名为匹配最终文件名。例如文件夹,\src\module被重命名为\src\modules.js\。
Removing .js from the folder name solved the problem.
从文件夹名中删除.js解决了这个问题。
#4
0
Using PhantomJS to generate snapshots for AngularJS.
使用PhantomJS为AngularJS生成快照。
The snapshots script goes through an array of urls of which it has to take snapshots.
快照脚本通过一个url数组,必须对其进行快照。
Narrowed down to the possible cause and as it turned out there was a bug in my latest fix in AngularJS. This bug resulted in the constantly switching the home page and the page where the error occurred.
我把范围缩小到可能的原因,结果发现我最新修复的AngularJS中有一个bug。这个错误导致不断地切换发生错误的主页和页面。
Code Visualization:
代码可视化:
$state.go('home state');
...
$state.go('an other state');
...
$state.go('home state');
...
$state.go('an other state');
...
$state.go('home state');
...
...
=> Error: PhantomJS exited unexpectedly with exit code -1073741819
In short:
简而言之:
For me this error was caused by an infinite redirect loop.
对我来说,这个错误是由一个无限重定向循环引起的。
#5
-1
The warning PhantomJS exited unexpectedly with exit code -1073741819
is also displayed when your local PhantomJS is incompatible or corrupt.
当您的本地PhantomJS不兼容或损坏时,也会显示带有出口代码-1073741819的意外发出的警告显象。
With npm list -g phantomjs
you can check your PhantomJS version.
使用npm列表-g phantomjs可以检查你的phantomjs版本。
If you think that it is corrupt, just reinstall it with:
如果您认为它是腐败的,只需重新安装:
npm uninstall phantomjs -g
npm install phantomjs -g