我正在使用node-phantom npm模块,每当我做一个超级简单的测试,比如
phantom=require('node-phantom');
var phantom=require('node-phantom');
phantom.create(function(err,ph) {
console.log("testing");
ph.exit();
});它打印以下错误: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.
有人知道这是什么原因吗?
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",
}
}(幻影有多种版本,因为我已经尝试过了)
发布于 2015-09-15 04:46:45
在window.location.hostname文件中将node-phantom.js更改为window.location.host。
https://stackoverflow.com/questions/31998719
复制相似问题