I have the following project structure :
WEBCONTENT /run.js
utils /utils.js
Here is run.js file:
var casper = require("casper").create();
var utils = require("../utils/utils");
Here is utils.js file:
try{
var x = require("casper").selectedPath;
}catch(error){
console.log(error);//cannot find module casper
}
once I run the bellow command :
casperjs run.js
I receive this error : cannot find module casper
I tried other paths such as ../casper
, ./casper
. but no luck !
please tell me how can I use require properly inside utils.js ? thanks
PLEASE NOTE , I installed casperjs successfully, there is no problem with that ! since the require in run.js works , however the require in utils.js crash