You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var url = 'http://www.baidu.com';
var monitor = new index.Monitor(url);
monitor.capture(function(code){
console.log(monitor.log); // from phantom
console.log('done, exit [' + code + ']');
});
为了加载phantomjs子目录下的index.js,我改成这样了:
$ head -15 index.js
。。。
var phantomjs = require('./phantomjs/index.js');
var binPath = phantomjs.path;
执行出错了,提示/phantomjs/index.js没有定义:“phantom”,这是为啥呢??
$ node t.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
ReferenceError: phantom is not defined
at Object. (~/Desktop/Share/page-monitor-master/phantomjs/index.js:12:1)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object. (~/Desktop/Share/page-monitor-master/index.js:12:17)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
The text was updated successfully, but these errors were encountered:
我的代码结构是这样的(其中t.js是我的测试代码)
$ tree
.
├── CHANGELOG.md
├── demo
│ ├── 1409037825746-1409037838093.png
│ ├── 1409037838093-1409037882033.png
│ ├── 1409037882033-1409037916727.png
│ ├── 1409038130483-1409038137417.png
│ └── ui.png
├── index.js
├── package.json
├── phantomjs
│ ├── diff.js
│ ├── highlight.html
│ ├── highlight.js
│ ├── index.js
│ └── walk.js
├── README.md
├── t.js
└── util.js
$ cat t.js
var index = require('./index.js');
var url = 'http://www.baidu.com';
var monitor = new index.Monitor(url);
monitor.capture(function(code){
console.log(monitor.log); // from phantom
console.log('done, exit [' + code + ']');
});
为了加载phantomjs子目录下的index.js,我改成这样了:
$ head -15 index.js
。。。
var phantomjs = require('./phantomjs/index.js');
var binPath = phantomjs.path;
执行出错了,提示/phantomjs/index.js没有定义:“phantom”,这是为啥呢??
$ node t.js
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
ReferenceError: phantom is not defined
at Object. (~/Desktop/Share/page-monitor-master/phantomjs/index.js:12:1)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object. (~/Desktop/Share/page-monitor-master/index.js:12:17)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
The text was updated successfully, but these errors were encountered: