require() fails in CasperJS

As per this answer, I tried opening a local json file. This is an insert form my script:

var json = require('pars.json');
casper.echo("Starting");

The 'pars.json' file is in the same folder as the script. On my Win7 machine with CasperJS version 1.1.2 and PhantomJS version 2.1.1, this works.

However, it always fails when I try to run it on a Win10 machine with the same versions of Phantom and Casper.

If I remove the 'require...' line, the script runs normally. Also, I get no error message, what is happening?

EDIT: I tried putting the file in c: and setting and using require('c:pars.json');, but it still does not work.

链接地址: http://www.djcxy.com/p/73490.html

上一篇: 在Haskell中的Ottmann算法?

下一篇: require()在CasperJS中失败