Using CasperJS as a Portable Installation?

I'm trying to run CasperJS in a portable way that doesn't involve setting the path variable in Windows. Currently I have gotten this to partially work by moving the phantomjs executable along with the entire contents of the CasperJS directory to the batchbin folder. I also edited the batch file to make it initialize casperJS using the current directory, which is where all the files are located.

Here is my directory with all the files:

My casperjs.bat file:

    set CASPER_PATH=%~dp0
    set ARGV=%*
    call phantomjs "%CASPER_BIN%bootstrap.js" --casper-path="%CASPER_PATH%" --cli %ARGV%

When I try to execute the file it gives me:

I tried to look at the bootstrap.js file to make it bypass the version check so it won't give me this error, but I'm not really sure what I'm doing.

How can I run casperJS as a portable without setting the path variable and having everything in one single directory?



try it without call:

phantomjs "%CASPER_BIN%bootstrap.js" --casper-path="%CASPER_PATH%" --cli %ARGV%

Got it to work. For the casperjs.bat file, put:

set CASPER_PATH=%~dp0..
set ARGV=%*
call phantomjs "%CASPER_BIN%bootstrap.js" --casper-path="%CASPER_PATH%" --cli %ARGV%

Move the phantomjs.exe executable to the same directory as this batch file. Should work fine.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.