If you want to run CasperJS through PhantomJS (since you are calling phantomjs test.js ), you will need some boot code at the beginning of the script:
phantom.casperPath = 'path/to/node_modules/casperjs'; phantom.injectJs('path/to/node_modules/casperjs/bin/bootstrap.js');
Keep in mind that even in windows you need to use a slash.
If you need a test environment, you will also need a line:
phantom.casperTest = true;
Everything is taken from this question: Running 'casperjs test' in phantom
Although it is possible, you should not do this. You must invoke CasperJS directly through the executable / batch file in node_modules / casperjs / batchbin.
source share