简体   繁体   English

基本测试中的PhantomJS错误

[英]PhantomJS error on basic tests

I'm using the node-phantom npm module, and whenever I do a super simple test like 我正在使用node-phantom npm模块,每当我做一个超级简单的测试时

phantom=require('node-phantom');
var phantom=require('node-phantom');
phantom.create(function(err,ph) {
    console.log("testing");
    ph.exit();
});

It prints the following error: phantom stdout: console msg:XMLHttpRequest cannot load http://127.0.0.1/socket.io/?EIO=3&transport=polling&t=1439501157936-0. Origin http://127.0.0.1:60689 is not allowed by Access-Control-Allow-Origin. 它显示以下错误: phantom stdout: console msg:XMLHttpRequest cannot load http://127.0.0.1/socket.io/?EIO=3&transport=polling&t=1439501157936-0. Origin http://127.0.0.1:60689 is not allowed by Access-Control-Allow-Origin. phantom stdout: console msg:XMLHttpRequest cannot load http://127.0.0.1/socket.io/?EIO=3&transport=polling&t=1439501157936-0. Origin http://127.0.0.1:60689 is not allowed by Access-Control-Allow-Origin.

Anyone know what the cause of this could be? 有人知道这可能是什么原因吗?

package.json: 的package.json:

{
  "name": "test",
  "version": "0.0.1",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-exec": "^0.4.6",
    "mocha": "^2.2.5",
    "node-phantom": "^0.2.5",
    "phantom": "^0.7.2",
    "phantomjs": "^1.9.18",
  }
}

(there are multiple versions of phantom because I've been trying some out) (幻影有多个版本,因为我一直在尝试一些)

更改window.location.hostnamewindow.location.hostnode-phantom.js文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM