Reputation: 1
I have followed an tutorial on casperjs ending up with this script:
phantom.casperPath = "/usr/local/Cellar/casperjs/";
phantom.injectJs(phantom.casperPath + "/bin/bootstrap.js");
var utils = require('utils');
var casper = require('casper').create();
casper.start('http://www.google.com');
casper.wait(3000,function(){
this.echo(this.getTitle());
});
casper.then(function (){
casper.exit();
});
casper.run();
When I run the script I get this messages:
Error: Cannot find module 'utils'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
Im running mac os and its pahntomjs and casperjs is both successfully installed; "CasperJS version 1.1.0-beta3 at /usr/local/Cellar/casperjs/1.1-beta3/libexec, using phantomjs version 1.9.7"
Upvotes: 0
Views: 1774
Reputation: 449
Did you install all pre-reqs of phantomjs?
Packages CentOS:
gcc gcc-c++ make flex bison gperf ruby \
openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel \
libpng-devel libjpeg-devel
Packages Ubuntu:
build-essential g++ flex bison gperf ruby perl \
libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev \
libpng-dev libjpeg-dev
Second
Why do you need injects the bootstrap? Phantomjs always use the bootstrap.js when run, so you can remove it unless you make some changes in this file.
Upvotes: 1